diff mbox series

PCI: free of node in pci_scan_device's error path

Message ID 20210123005838.3623618-1-dmitry.baryshkov@linaro.org
State New
Headers show
Series PCI: free of node in pci_scan_device's error path | expand

Commit Message

Dmitry Baryshkov Jan. 23, 2021, 12:58 a.m. UTC
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.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Fixes: 98d9f30c820d ("pci/of: Match PCI devices to OF nodes dynamically")
---
 drivers/pci/probe.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Leon Romanovsky Jan. 24, 2021, 5:39 a.m. UTC | #1
On Sat, Jan 23, 2021 at 03:58:38AM +0300, Dmitry Baryshkov wrote:
> 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.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Fixes: 98d9f30c820d ("pci/of: Match PCI devices to OF nodes dynamically")

Fixes should come before your SOB, otherwise many static checkers will
report the current format as an error.

Thanks
diff mbox series

Patch

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 953f15abc850..be51670572fa 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -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;