summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Baryshkov <dmitry.baryshkov@linaro.org>2021-01-25 02:28:26 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-05-19 11:13:01 +0300
commitee93cdcbe0b553b6c1e457ad33c64dd90600ad97 (patch)
tree02fce46b87d38bd7bcd0f6d3daddaceccc139997
parentc5c0ede221d768c600b7154d0afee05cb3554d86 (diff)
downloadlinux-ee93cdcbe0b553b6c1e457ad33c64dd90600ad97.tar.xz
PCI: Release OF node in pci_scan_device()'s error path
[ 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: 98d9f30c820d ("pci/of: Match PCI devices to OF nodes dynamically") Link: https://lore.kernel.org/r/20210124232826.1879-1-dmitry.baryshkov@linaro.org Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/pci/probe.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 4289030b0fff..ece90a23936d 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2367,6 +2367,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;