Re: [PATCH] PCI: Check for the existence of 'dev.of_node' before calling of_platform_populate()
From: Linus Torvalds
Date: Tue Jul 16 2024 - 14:02:32 EST
On Tue, 16 Jul 2024 at 01:04, Manivannan Sadhasivam
<manivannan.sadhasivam@xxxxxxxxxx> wrote:
>
> - if (IS_ENABLED(CONFIG_OF) && pci_is_bridge(dev)) {
> + if (IS_ENABLED(CONFIG_OF) && dev_of_node(&dev->dev) && pci_is_bridge(dev)) {
> retval = of_platform_populate(dev->dev.of_node, NULL, NULL,
> &dev->dev);
I think you should just drop the IS_ENABLED(CONFIG_OF) check entirely.
afaik, dev_of_node() already returns NULL if CONFIG_OF isn't set.
So the bug was literally that you based the decision on something
pointless that shouldn't be there at all.
Linus