linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: mediatek: Fix refcount leak in mtk_pcie_subsys_powerup
@ 2022-03-09  9:19 Miaoqian Lin
  2022-03-10  6:56 ` Miles Chen
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Miaoqian Lin @ 2022-03-09  9:19 UTC (permalink / raw)
  To: Ryder Lee, Jianjun Wang, Lorenzo Pieralisi, Rob Herring,
	Krzysztof Wilczyński, Bjorn Helgaas, Matthias Brugger,
	Chuanjia Liu, linux-pci, linux-mediatek, linux-kernel,
	linux-arm-kernel
  Cc: linmq006

The of_find_compatible_node() function returns a node pointer with
refcount incremented, We should use of_node_put() on it when done
Add the missing of_node_put() to release the refcount.

Fixes: 87e8657ba99c ("PCI: mediatek: Add new method to get shared pcie-cfg base address")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 drivers/pci/controller/pcie-mediatek.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pci/controller/pcie-mediatek.c b/drivers/pci/controller/pcie-mediatek.c
index ddfbd4aebdec..be8bd919cb88 100644
--- a/drivers/pci/controller/pcie-mediatek.c
+++ b/drivers/pci/controller/pcie-mediatek.c
@@ -1008,6 +1008,7 @@ static int mtk_pcie_subsys_powerup(struct mtk_pcie *pcie)
 					   "mediatek,generic-pciecfg");
 	if (cfg_node) {
 		pcie->cfg = syscon_node_to_regmap(cfg_node);
+		of_node_put(cfg_node);
 		if (IS_ERR(pcie->cfg))
 			return PTR_ERR(pcie->cfg);
 	}
-- 
2.17.1


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

* Re: [PATCH] PCI: mediatek: Fix refcount leak in mtk_pcie_subsys_powerup
  2022-03-09  9:19 [PATCH] PCI: mediatek: Fix refcount leak in mtk_pcie_subsys_powerup Miaoqian Lin
@ 2022-03-10  6:56 ` Miles Chen
  2022-03-10 14:48 ` AngeloGioacchino Del Regno
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Miles Chen @ 2022-03-10  6:56 UTC (permalink / raw)
  To: linmq006
  Cc: bhelgaas, chuanjia.liu, jianjun.wang, kw, linux-arm-kernel,
	linux-kernel, linux-mediatek, linux-pci, lorenzo.pieralisi,
	matthias.bgg, robh, ryder.lee

Hi Miaoqian,

> The of_find_compatible_node() function returns a node pointer with
> refcount incremented, We should use of_node_put() on it when done
> Add the missing of_node_put() to release the refcount.
> 
> Fixes: 87e8657ba99c ("PCI: mediatek: Add new method to get shared pcie-cfg base address")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
>  drivers/pci/controller/pcie-mediatek.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/pci/controller/pcie-mediatek.c b/drivers/pci/controller/pcie-mediatek.c
> index ddfbd4aebdec..be8bd919cb88 100644
> --- a/drivers/pci/controller/pcie-mediatek.c
> +++ b/drivers/pci/controller/pcie-mediatek.c
> @@ -1008,6 +1008,7 @@ static int mtk_pcie_subsys_powerup(struct mtk_pcie *pcie)
>  					   "mediatek,generic-pciecfg");
>  	if (cfg_node) {
>  		pcie->cfg = syscon_node_to_regmap(cfg_node);
> +		of_node_put(cfg_node);
>  		if (IS_ERR(pcie->cfg))
>  			return PTR_ERR(pcie->cfg);
>  	}

Thanks for this patch.

Reviewed-by: Miles Chen <miles.chen@mediatek.com>

Thanks,
Miles

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

* Re: [PATCH] PCI: mediatek: Fix refcount leak in mtk_pcie_subsys_powerup
  2022-03-09  9:19 [PATCH] PCI: mediatek: Fix refcount leak in mtk_pcie_subsys_powerup Miaoqian Lin
  2022-03-10  6:56 ` Miles Chen
@ 2022-03-10 14:48 ` AngeloGioacchino Del Regno
  2022-03-24 21:03 ` Rob Herring
  2022-04-08 14:30 ` Lorenzo Pieralisi
  3 siblings, 0 replies; 5+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-03-10 14:48 UTC (permalink / raw)
  To: Miaoqian Lin, Ryder Lee, Jianjun Wang, Lorenzo Pieralisi,
	Rob Herring, Krzysztof Wilczyński, Bjorn Helgaas,
	Matthias Brugger, Chuanjia Liu, linux-pci, linux-mediatek,
	linux-kernel, linux-arm-kernel

Il 09/03/22 10:19, Miaoqian Lin ha scritto:
> The of_find_compatible_node() function returns a node pointer with
> refcount incremented, We should use of_node_put() on it when done
> Add the missing of_node_put() to release the refcount.
> 
> Fixes: 87e8657ba99c ("PCI: mediatek: Add new method to get shared pcie-cfg base address")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> Reviewed-by: Miles Chen <miles.chen@mediatek.com>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

> ---
>   drivers/pci/controller/pcie-mediatek.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/pci/controller/pcie-mediatek.c b/drivers/pci/controller/pcie-mediatek.c
> index ddfbd4aebdec..be8bd919cb88 100644
> --- a/drivers/pci/controller/pcie-mediatek.c
> +++ b/drivers/pci/controller/pcie-mediatek.c
> @@ -1008,6 +1008,7 @@ static int mtk_pcie_subsys_powerup(struct mtk_pcie *pcie)
>   					   "mediatek,generic-pciecfg");
>   	if (cfg_node) {
>   		pcie->cfg = syscon_node_to_regmap(cfg_node);
> +		of_node_put(cfg_node);
>   		if (IS_ERR(pcie->cfg))
>   			return PTR_ERR(pcie->cfg);
>   	}
> 



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

* Re: [PATCH] PCI: mediatek: Fix refcount leak in mtk_pcie_subsys_powerup
  2022-03-09  9:19 [PATCH] PCI: mediatek: Fix refcount leak in mtk_pcie_subsys_powerup Miaoqian Lin
  2022-03-10  6:56 ` Miles Chen
  2022-03-10 14:48 ` AngeloGioacchino Del Regno
@ 2022-03-24 21:03 ` Rob Herring
  2022-04-08 14:30 ` Lorenzo Pieralisi
  3 siblings, 0 replies; 5+ messages in thread
From: Rob Herring @ 2022-03-24 21:03 UTC (permalink / raw)
  To: Miaoqian Lin
  Cc: Ryder Lee, Jianjun Wang, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Bjorn Helgaas, Matthias Brugger,
	Chuanjia Liu, linux-pci, linux-mediatek, linux-kernel,
	linux-arm-kernel

On Wed, Mar 09, 2022 at 09:19:52AM +0000, Miaoqian Lin wrote:
> The of_find_compatible_node() function returns a node pointer with
> refcount incremented, We should use of_node_put() on it when done
> Add the missing of_node_put() to release the refcount.
> 
> Fixes: 87e8657ba99c ("PCI: mediatek: Add new method to get shared pcie-cfg base address")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
>  drivers/pci/controller/pcie-mediatek.c | 1 +
>  1 file changed, 1 insertion(+)

Acked-by: Rob Herring <robh@kernel.org>

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

* Re: [PATCH] PCI: mediatek: Fix refcount leak in mtk_pcie_subsys_powerup
  2022-03-09  9:19 [PATCH] PCI: mediatek: Fix refcount leak in mtk_pcie_subsys_powerup Miaoqian Lin
                   ` (2 preceding siblings ...)
  2022-03-24 21:03 ` Rob Herring
@ 2022-04-08 14:30 ` Lorenzo Pieralisi
  3 siblings, 0 replies; 5+ messages in thread
From: Lorenzo Pieralisi @ 2022-04-08 14:30 UTC (permalink / raw)
  To: linux-arm-kernel, linux-mediatek, Rob Herring, linux-kernel,
	Chuanjia Liu, Jianjun Wang, linux-pci, Miaoqian Lin,
	Bjorn Helgaas, Matthias Brugger, Krzysztof Wilczyński,
	Ryder Lee
  Cc: Lorenzo Pieralisi

On Wed, 9 Mar 2022 09:19:52 +0000, Miaoqian Lin wrote:
> The of_find_compatible_node() function returns a node pointer with
> refcount incremented, We should use of_node_put() on it when done
> Add the missing of_node_put() to release the refcount.
> 
> 

Applied to pci/mediatek, thanks!

[1/1] PCI: mediatek: Fix refcount leak in mtk_pcie_subsys_powerup
      https://git.kernel.org/lpieralisi/pci/c/214e0d8fe4

Thanks,
Lorenzo

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

end of thread, other threads:[~2022-04-08 14:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-09  9:19 [PATCH] PCI: mediatek: Fix refcount leak in mtk_pcie_subsys_powerup Miaoqian Lin
2022-03-10  6:56 ` Miles Chen
2022-03-10 14:48 ` AngeloGioacchino Del Regno
2022-03-24 21:03 ` Rob Herring
2022-04-08 14:30 ` Lorenzo Pieralisi

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