All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PCI: imx6: Add missing of_node_put() in imx6_pcie_probe
@ 2022-03-08  2:29 ` Miaoqian Lin
  0 siblings, 0 replies; 6+ messages in thread
From: Miaoqian Lin @ 2022-03-08  2:29 UTC (permalink / raw)
  To: Richard Zhu, Lucas Stach, Lorenzo Pieralisi, Rob Herring,
	Krzysztof Wilczyński, Bjorn Helgaas, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Trent Piepho, linux-pci, linux-arm-kernel,
	linux-kernel
  Cc: linmq006

The device_node pointer is returned by of_parse_phandle()  with refcount
incremented. We should use of_node_put() on it when done.

Fixes: 1df82ec46600 ("PCI: imx: Add workaround for e10728, IMX7d PCIe PLL failure")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 drivers/pci/controller/dwc/pci-imx6.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
index 6974bd5aa116..bcc338ab6c11 100644
--- a/drivers/pci/controller/dwc/pci-imx6.c
+++ b/drivers/pci/controller/dwc/pci-imx6.c
@@ -1050,6 +1050,7 @@ static int imx6_pcie_probe(struct platform_device *pdev)
 		struct resource res;
 
 		ret = of_address_to_resource(np, 0, &res);
+		of_node_put(np);
 		if (ret) {
 			dev_err(dev, "Unable to map PCIe PHY\n");
 			return ret;
-- 
2.17.1


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

* [PATCH] PCI: imx6: Add missing of_node_put() in imx6_pcie_probe
@ 2022-03-08  2:29 ` Miaoqian Lin
  0 siblings, 0 replies; 6+ messages in thread
From: Miaoqian Lin @ 2022-03-08  2:29 UTC (permalink / raw)
  To: Richard Zhu, Lucas Stach, Lorenzo Pieralisi, Rob Herring,
	Krzysztof Wilczyński, Bjorn Helgaas, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Trent Piepho, linux-pci, linux-arm-kernel,
	linux-kernel
  Cc: linmq006

The device_node pointer is returned by of_parse_phandle()  with refcount
incremented. We should use of_node_put() on it when done.

Fixes: 1df82ec46600 ("PCI: imx: Add workaround for e10728, IMX7d PCIe PLL failure")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 drivers/pci/controller/dwc/pci-imx6.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
index 6974bd5aa116..bcc338ab6c11 100644
--- a/drivers/pci/controller/dwc/pci-imx6.c
+++ b/drivers/pci/controller/dwc/pci-imx6.c
@@ -1050,6 +1050,7 @@ static int imx6_pcie_probe(struct platform_device *pdev)
 		struct resource res;
 
 		ret = of_address_to_resource(np, 0, &res);
+		of_node_put(np);
 		if (ret) {
 			dev_err(dev, "Unable to map PCIe PHY\n");
 			return ret;
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* RE: [PATCH] PCI: imx6: Add missing of_node_put() in imx6_pcie_probe
  2022-03-08  2:29 ` Miaoqian Lin
@ 2022-03-10  7:41   ` Hongxing Zhu
  -1 siblings, 0 replies; 6+ messages in thread
From: Hongxing Zhu @ 2022-03-10  7:41 UTC (permalink / raw)
  To: Miaoqian Lin, Lucas Stach, Lorenzo Pieralisi, Rob Herring,
	Krzysztof Wilczy��ski, Bjorn Helgaas, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	dl-linux-imx, Trent Piepho, linux-pci, linux-arm-kernel,
	linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="gb2312", Size: 1779 bytes --]

> -----Original Message-----
> From: Miaoqian Lin <linmq006@gmail.com>
> Sent: 2022Äê3ÔÂ8ÈÕ 10:29
> To: Hongxing Zhu <hongxing.zhu@nxp.com>; Lucas Stach
> <l.stach@pengutronix.de>; Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>; Rob
> Herring <robh@kernel.org>; Krzysztof Wilczy¨½ski <kw@linux.com>; Bjorn
> Helgaas <bhelgaas@google.com>; Shawn Guo <shawnguo@kernel.org>;
> Sascha Hauer <s.hauer@pengutronix.de>; Pengutronix Kernel Team
> <kernel@pengutronix.de>; Fabio Estevam <festevam@gmail.com>;
> dl-linux-imx <linux-imx@nxp.com>; Trent Piepho <tpiepho@impinj.com>;
> linux-pci@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
> linux-kernel@vger.kernel.org
> Cc: linmq006@gmail.com
> Subject: [PATCH] PCI: imx6: Add missing of_node_put() in imx6_pcie_probe
> 
> The device_node pointer is returned by of_parse_phandle()  with refcount
> incremented. We should use of_node_put() on it when done.
> 
> Fixes: 1df82ec46600 ("PCI: imx: Add workaround for e10728, IMX7d PCIe PLL
> failure")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Thanks.

Best Regards
Richard Zhu

> ---
>  drivers/pci/controller/dwc/pci-imx6.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/pci/controller/dwc/pci-imx6.c
> b/drivers/pci/controller/dwc/pci-imx6.c
> index 6974bd5aa116..bcc338ab6c11 100644
> --- a/drivers/pci/controller/dwc/pci-imx6.c
> +++ b/drivers/pci/controller/dwc/pci-imx6.c
> @@ -1050,6 +1050,7 @@ static int imx6_pcie_probe(struct platform_device
> *pdev)
>  		struct resource res;
> 
>  		ret = of_address_to_resource(np, 0, &res);
> +		of_node_put(np);
>  		if (ret) {
>  			dev_err(dev, "Unable to map PCIe PHY\n");
>  			return ret;
> --
> 2.17.1


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

* RE: [PATCH] PCI: imx6: Add missing of_node_put() in imx6_pcie_probe
@ 2022-03-10  7:41   ` Hongxing Zhu
  0 siblings, 0 replies; 6+ messages in thread
From: Hongxing Zhu @ 2022-03-10  7:41 UTC (permalink / raw)
  To: Miaoqian Lin, Lucas Stach, Lorenzo Pieralisi, Rob Herring,
	Krzysztof Wilczy��ski, Bjorn Helgaas, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	dl-linux-imx, Trent Piepho, linux-pci, linux-arm-kernel,
	linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="gb2312", Size: 1779 bytes --]

> -----Original Message-----
> From: Miaoqian Lin <linmq006@gmail.com>
> Sent: 2022Äê3ÔÂ8ÈÕ 10:29
> To: Hongxing Zhu <hongxing.zhu@nxp.com>; Lucas Stach
> <l.stach@pengutronix.de>; Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>; Rob
> Herring <robh@kernel.org>; Krzysztof Wilczy¨½ski <kw@linux.com>; Bjorn
> Helgaas <bhelgaas@google.com>; Shawn Guo <shawnguo@kernel.org>;
> Sascha Hauer <s.hauer@pengutronix.de>; Pengutronix Kernel Team
> <kernel@pengutronix.de>; Fabio Estevam <festevam@gmail.com>;
> dl-linux-imx <linux-imx@nxp.com>; Trent Piepho <tpiepho@impinj.com>;
> linux-pci@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
> linux-kernel@vger.kernel.org
> Cc: linmq006@gmail.com
> Subject: [PATCH] PCI: imx6: Add missing of_node_put() in imx6_pcie_probe
> 
> The device_node pointer is returned by of_parse_phandle()  with refcount
> incremented. We should use of_node_put() on it when done.
> 
> Fixes: 1df82ec46600 ("PCI: imx: Add workaround for e10728, IMX7d PCIe PLL
> failure")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Thanks.

Best Regards
Richard Zhu

> ---
>  drivers/pci/controller/dwc/pci-imx6.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/pci/controller/dwc/pci-imx6.c
> b/drivers/pci/controller/dwc/pci-imx6.c
> index 6974bd5aa116..bcc338ab6c11 100644
> --- a/drivers/pci/controller/dwc/pci-imx6.c
> +++ b/drivers/pci/controller/dwc/pci-imx6.c
> @@ -1050,6 +1050,7 @@ static int imx6_pcie_probe(struct platform_device
> *pdev)
>  		struct resource res;
> 
>  		ret = of_address_to_resource(np, 0, &res);
> +		of_node_put(np);
>  		if (ret) {
>  			dev_err(dev, "Unable to map PCIe PHY\n");
>  			return ret;
> --
> 2.17.1


[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] PCI: imx6: Add missing of_node_put() in imx6_pcie_probe
  2022-03-08  2:29 ` Miaoqian Lin
@ 2022-03-10 19:06   ` Rob Herring
  -1 siblings, 0 replies; 6+ messages in thread
From: Rob Herring @ 2022-03-10 19:06 UTC (permalink / raw)
  To: Miaoqian Lin
  Cc: Richard Zhu, Lucas Stach, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Bjorn Helgaas, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Trent Piepho, PCI, linux-arm-kernel,
	linux-kernel

On Mon, Mar 7, 2022 at 8:29 PM Miaoqian Lin <linmq006@gmail.com> wrote:
>
> The device_node pointer is returned by of_parse_phandle()  with refcount
> incremented. We should use of_node_put() on it when done.
>
> Fixes: 1df82ec46600 ("PCI: imx: Add workaround for e10728, IMX7d PCIe PLL failure")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
>  drivers/pci/controller/dwc/pci-imx6.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
> index 6974bd5aa116..bcc338ab6c11 100644
> --- a/drivers/pci/controller/dwc/pci-imx6.c
> +++ b/drivers/pci/controller/dwc/pci-imx6.c
> @@ -1050,6 +1050,7 @@ static int imx6_pcie_probe(struct platform_device *pdev)
>                 struct resource res;
>
>                 ret = of_address_to_resource(np, 0, &res);
> +               of_node_put(np);

So now you are using the phy within the driver, but not holding a
reference to its node? That is wrong. Though if a struct device was
created for the phy's node, it would hold a reference. There are a
bunch of error paths where the reference should be dropped. But
really, this driver is a big mess with the phy binding and framework
not used and your nodes probably aren't going to be disappearing on
you anyways.

Rob

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

* Re: [PATCH] PCI: imx6: Add missing of_node_put() in imx6_pcie_probe
@ 2022-03-10 19:06   ` Rob Herring
  0 siblings, 0 replies; 6+ messages in thread
From: Rob Herring @ 2022-03-10 19:06 UTC (permalink / raw)
  To: Miaoqian Lin
  Cc: Richard Zhu, Lucas Stach, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Bjorn Helgaas, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Trent Piepho, PCI, linux-arm-kernel,
	linux-kernel

On Mon, Mar 7, 2022 at 8:29 PM Miaoqian Lin <linmq006@gmail.com> wrote:
>
> The device_node pointer is returned by of_parse_phandle()  with refcount
> incremented. We should use of_node_put() on it when done.
>
> Fixes: 1df82ec46600 ("PCI: imx: Add workaround for e10728, IMX7d PCIe PLL failure")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
>  drivers/pci/controller/dwc/pci-imx6.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
> index 6974bd5aa116..bcc338ab6c11 100644
> --- a/drivers/pci/controller/dwc/pci-imx6.c
> +++ b/drivers/pci/controller/dwc/pci-imx6.c
> @@ -1050,6 +1050,7 @@ static int imx6_pcie_probe(struct platform_device *pdev)
>                 struct resource res;
>
>                 ret = of_address_to_resource(np, 0, &res);
> +               of_node_put(np);

So now you are using the phy within the driver, but not holding a
reference to its node? That is wrong. Though if a struct device was
created for the phy's node, it would hold a reference. There are a
bunch of error paths where the reference should be dropped. But
really, this driver is a big mess with the phy binding and framework
not used and your nodes probably aren't going to be disappearing on
you anyways.

Rob

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2022-03-10 19:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-08  2:29 [PATCH] PCI: imx6: Add missing of_node_put() in imx6_pcie_probe Miaoqian Lin
2022-03-08  2:29 ` Miaoqian Lin
2022-03-10  7:41 ` Hongxing Zhu
2022-03-10  7:41   ` Hongxing Zhu
2022-03-10 19:06 ` Rob Herring
2022-03-10 19:06   ` Rob Herring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.