[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAL_JsqKpr9ksR2gse4fHPHbNfv9+TtSu99+Ofz1mZ16WNjswYA@mail.gmail.com>
Date: Thu, 10 Mar 2022 13:06:15 -0600
From: Rob Herring <robh@...nel.org>
To: Miaoqian Lin <linmq006@...il.com>
Cc: Richard Zhu <hongxing.zhu@....com>,
Lucas Stach <l.stach@...gutronix.de>,
Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
Krzysztof WilczyĆski <kw@...ux.com>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Fabio Estevam <festevam@...il.com>,
NXP Linux Team <linux-imx@....com>,
Trent Piepho <tpiepho@...inj.com>,
PCI <linux-pci@...r.kernel.org>,
linux-arm-kernel <linux-arm-kernel@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] PCI: imx6: Add missing of_node_put() in imx6_pcie_probe
On Mon, Mar 7, 2022 at 8:29 PM Miaoqian Lin <linmq006@...il.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@...il.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
Powered by blists - more mailing lists