PCI: Release OF node in pci_scan_device()'s error path
authorDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Sun, 24 Jan 2021 23:28:26 +0000 (02:28 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 22 May 2021 08:40:30 +0000 (10:40 +0200)
commitc864ded837fcf0bd67a1d78a3ff3c879b1fc255c
treec8222b1ed86365ccab87386c7409c0ac5e75cd29
parente12d8b1ca69a70e29d9ac7e09c92cb7fe63b363b
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>
drivers/pci/probe.c