PCI: free of node in pci_scan_device's error path
PATCH v2 1/1 PCI: free of node in pci_scan_device's error path
In the pci_scan_device() if pci_setup_device() fails for any reason, the code will not release device's of_node by calling pci_release_of_node(). Fix that by calling the release function.
---
Changes since v1:
- Changed the order of Fixes and S-o-B tags.
--- drivers/pci/probe.c | 1 + 1 file changed, 1 insertion(+)
drivers/pci/probe.c +1 -0
@@ -2353,6 +2353,7 @@ static struct pci_dev *pci_scan_device(struct pci_bus *bus, int devfn)pci_set_of_node (dev);if (pci_setup_device (dev)) { +pci_release_of_node (dev);pci_bus_put (dev->bus);kfree (dev);return NULL ;
Signature · 1 line
2.29.2
Quoted 6 lines · Dmitry Baryshkov
In the
pci_scan_device()ifpci_setup_device()fails for any reason, the code will not release device'sof_nodeby callingpci_release_of_node(). Fix that by calling the release function.Fixes 98d9f30c820d ("pci/of: Match PCI devices to OF nodes dynamically")Signed-off-by Dmitry Baryshkov <[email protected]>
Quoted 9 lines
---
Changes since v1:
- Changed the order of Fixes and S-o-B tags.--- drivers/pci/probe.c | 1 + 1 file changed, 1 insertion(+)
Thanks,
Quoted 6 lines · Dmitry Baryshkov
In the
pci_scan_device()ifpci_setup_device()fails for any reason, the code will not release device'sof_nodeby callingpci_release_of_node(). Fix that by calling the release function.Fixes 98d9f30c820d ("pci/of: Match PCI devices to OF nodes dynamically")Signed-off-by Dmitry Baryshkov <[email protected]>
Applied with Leon's reviewed-by to pci/enumeration for v5.13, thanks!
Quoted 25 lines
---
Changes since v1:
- Changed the order of Fixes and S-o-B tags.--- drivers/pci/probe.c | 1 + 1 file changed, 1 insertion(+)drivers/pci/probe.c +1
-0@@ -2353,6 +2353,7 @@ static struct pci_dev *pci_scan_device(struct pci_bus *bus, int devfn)pci_set_of_node (dev);if (pci_setup_device (dev)) { +pci_release_of_node (dev);pci_bus_put (dev->bus);kfree (dev);return NULL ;Signature · 1 line
2.29.2