提交 29cb3ad5 编写于 作者: D Dmitry Baryshkov 提交者: Yang Yingliang

PCI: Release OF node in pci_scan_device()'s error path

stable inclusion
from linux-4.19.191
commit 691062feb4ed8303be75ab07c5c1e09311bd8c80

--------------------------------

[ Upstream commit c99e755a ]

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: 98d9f30c ("pci/of: Match PCI devices to OF nodes dynamically")
Link: https://lore.kernel.org/r/20210124232826.1879-1-dmitry.baryshkov@linaro.orgSigned-off-by: NDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
Reviewed-by: NLeon Romanovsky <leonro@nvidia.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 81eb6405
...@@ -2779,6 +2779,7 @@ static struct pci_dev *pci_scan_device(struct pci_bus *bus, int devfn) ...@@ -2779,6 +2779,7 @@ static struct pci_dev *pci_scan_device(struct pci_bus *bus, int devfn)
pci_set_of_node(dev); pci_set_of_node(dev);
if (pci_setup_device(dev)) { if (pci_setup_device(dev)) {
pci_release_of_node(dev);
pci_bus_put(dev->bus); pci_bus_put(dev->bus);
kfree(dev); kfree(dev);
return NULL; return NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册