linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] PCI: free of node in pci_scan_device's error path
@ 2021-01-24 23:28 Dmitry Baryshkov
  2021-01-25  5:32 ` Leon Romanovsky
  2021-03-23 15:23 ` Bjorn Helgaas
  0 siblings, 2 replies; 3+ messages in thread
From: Dmitry Baryshkov @ 2021-01-24 23:28 UTC (permalink / raw)
  To: Bjorn Helgaas, linux-pci

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.

Fixes: 98d9f30c820d ("pci/of: Match PCI devices to OF nodes dynamically")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---

Changes since v1:
 - Changed the order of Fixes and S-o-B tags.

---
 drivers/pci/probe.c | 1 +
 1 file changed, 1 insertion(+)


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;
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] PCI: free of node in pci_scan_device's error path
  2021-01-24 23:28 [PATCH v2] PCI: free of node in pci_scan_device's error path Dmitry Baryshkov
@ 2021-01-25  5:32 ` Leon Romanovsky
  2021-03-23 15:23 ` Bjorn Helgaas
  1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2021-01-25  5:32 UTC (permalink / raw)
  To: Dmitry Baryshkov; +Cc: Bjorn Helgaas, linux-pci

On Mon, Jan 25, 2021 at 02:28:26AM +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.
>
> Fixes: 98d9f30c820d ("pci/of: Match PCI devices to OF nodes dynamically")
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
>
> Changes since v1:
>  - Changed the order of Fixes and S-o-B tags.
>
> ---
>  drivers/pci/probe.c | 1 +
>  1 file changed, 1 insertion(+)
>

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] PCI: free of node in pci_scan_device's error path
  2021-01-24 23:28 [PATCH v2] PCI: free of node in pci_scan_device's error path Dmitry Baryshkov
  2021-01-25  5:32 ` Leon Romanovsky
@ 2021-03-23 15:23 ` Bjorn Helgaas
  1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Helgaas @ 2021-03-23 15:23 UTC (permalink / raw)
  To: Dmitry Baryshkov; +Cc: Bjorn Helgaas, linux-pci

On Mon, Jan 25, 2021 at 02:28:26AM +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.
> 
> Fixes: 98d9f30c820d ("pci/of: Match PCI devices to OF nodes dynamically")
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

Applied with Leon's reviewed-by to pci/enumeration for v5.13, thanks!

> ---
> 
> Changes since v1:
>  - Changed the order of Fixes and S-o-B tags.
> 
> ---
>  drivers/pci/probe.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> 
> 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;
> -- 
> 2.29.2
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-23 15:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-24 23:28 [PATCH v2] PCI: free of node in pci_scan_device's error path Dmitry Baryshkov
2021-01-25  5:32 ` Leon Romanovsky
2021-03-23 15:23 ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).