From: Bjorn Helgaas <helgaas@kernel.org>
To: Liang He <windhl@126.com>
Cc: jim2101024@gmail.com, f.fainelli@gmail.com,
bcm-kernel-feedback-list@broadcom.com, lpieralisi@kernel.org,
robh@kernel.org, kw@linux.com, bhelgaas@google.com,
p.zabel@pengutronix.de, linux-pci@vger.kernel.org,
linmq006@gmail.com
Subject: Re: [PATCH] pci: controller: brcmstb: Move of_node_put() out of 'if' in brcm_pcie_probe
Date: Thu, 14 Jul 2022 11:47:26 -0500 [thread overview]
Message-ID: <20220714164726.GA1021692@bhelgaas> (raw)
In-Reply-To: <20220704065501.275677-1-windhl@126.com>
On Mon, Jul 04, 2022 at 02:55:01PM +0800, Liang He wrote:
> Commit 3a87cb8f6a ("Fix refcount leak in brcm_pcie_probe()") adds
> of_node_put() for of_parse_phandle() in fail path but not adds it
> correctly in normal path. We should move the second of_node_put()
> out of the 'if(pci_msi_enabled() && msi_np == pcie->np)'.
>
> Fixes: 3a87cb8f6a ("Fix refcount leak in brcm_pcie_probe()")
> Co-authored-by: Miaoqian Lin <linmq006@gmail.com>
> Signed-off-by: Liang He <windhl@126.com>
> ---
> Patched file has been compiled test in next branch.
>
> drivers/pci/controller/pcie-brcmstb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
> index 48a7148376d4..80e19d053e9f 100755
> --- a/drivers/pci/controller/pcie-brcmstb.c
> +++ b/drivers/pci/controller/pcie-brcmstb.c
> @@ -1413,8 +1413,8 @@ static int brcm_pcie_probe(struct platform_device *pdev)
> of_node_put(msi_np);
> goto fail;
> }
> - of_node_put(msi_np);
> }
> + of_node_put(msi_np);
Can we just move the of_parse_phandle() and related checking into
brcm_pcie_enable_msi()? It can return success without doing anything
if !pci_msi_enabled() or msi_np != pcie_np.
If you don't want to do that, please just send a revised version of
3a87cb8f6a72 ("PCI: brcmstb: Fix refcount leak in brcm_pcie_probe()").
That's not upstream yet, and I don't want to clutter the git history
with a fix of a fix.
> bridge->ops = pcie->type == BCM7425 ? &brcm_pcie_ops32 : &brcm_pcie_ops;
> bridge->sysdata = pcie;
> --
> 2.25.1
>
next prev parent reply other threads:[~2022-07-14 16:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-04 6:55 [PATCH] pci: controller: brcmstb: Move of_node_put() out of 'if' in brcm_pcie_probe Liang He
2022-07-14 16:47 ` Bjorn Helgaas [this message]
2022-07-14 23:58 ` Liang He
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220714164726.GA1021692@bhelgaas \
--to=helgaas@kernel.org \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=bhelgaas@google.com \
--cc=f.fainelli@gmail.com \
--cc=jim2101024@gmail.com \
--cc=kw@linux.com \
--cc=linmq006@gmail.com \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=robh@kernel.org \
--cc=windhl@126.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).