Skip to content

Commit

Permalink
PCI: Release OF node in pci_scan_device()'s error path
Browse files Browse the repository at this point in the history
[ Upstream commit c99e755a4a4c165cad6effb39faffd0f3377c02d ]

In 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.

Fixes: 98d9f30 ("pci/of: Match PCI devices to OF nodes dynamically")
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Dmitry Baryshkov <[email protected]>
Signed-off-by: Bjorn Helgaas <[email protected]>
Reviewed-by: Leon Romanovsky <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
lumag authored and gregkh committed May 22, 2021
1 parent a243eb7 commit 691062f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/pci/probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -2359,6 +2359,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;
Expand Down

0 comments on commit 691062f

Please sign in to comment.