That doesn't happen, because the if (subbus... is in the for loop, which checks for NULL. the search_bus_resources() is always called outside the for loop.
You're right. I should have looked at the code first, instead of just the patch. There wasn't enough context.
If there is no bus there, maybe the resource shouldn't be subtractive. Maybe we should print a message when that happens so that we can fix the problem.
What would cause it to be subtractive? We should print an error message if this occurs, but be should also react sanely. How do we proceed?
This has always been confusing to me. I don't know if we use it "correctly" anywhere in coreboot.
My understanding is that subtractive resources should be used when there is nothing explicitly directing an address range to a specific bus or device. So, if an address arrives that doesn't match anything you have and there is a subtractive resource, pass it that way.
I'd guess that it's left over from another era, but I'm not sure. Is there another use for subtractive resources?
Thanks, Myles