From: Liang He <windhl@126.com>
To: Zhiqiang.Hou@nxp.com, lpieralisi@kernel.org, robh@kernel.org,
kw@linux.com, bhelgaas@google.com, linux-pci@vger.kernel.org,
windhl@126.com, linmq006@gmail.com
Subject: [PATCH] pci: controller: mobiveil: Hold reference returned by of_parse_phandle()
Date: Mon, 4 Jul 2022 14:26:08 +0800 [thread overview]
Message-ID: <20220704062608.273440-1-windhl@126.com> (raw)
In ls_g4_pcie_probe(), we should hold the reference returned by
of_parse_phandle() and use it to call of_node_put() for refcount
balance.
Fixes: d29ad70a813b ("PCI: mobiveil: Add PCIe Gen4 RC driver for Layerscape SoCs")
Co-authored-by: Miaoqian Lin <linmq006@gmail.com>
Signed-off-by: Liang He <windhl@126.com>
---
drivers/pci/controller/mobiveil/pcie-layerscape-gen4.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/controller/mobiveil/pcie-layerscape-gen4.c b/drivers/pci/controller/mobiveil/pcie-layerscape-gen4.c
index d7b7350f02dd..075aa487f92e 100644
--- a/drivers/pci/controller/mobiveil/pcie-layerscape-gen4.c
+++ b/drivers/pci/controller/mobiveil/pcie-layerscape-gen4.c
@@ -204,13 +204,15 @@ static int __init ls_g4_pcie_probe(struct platform_device *pdev)
struct pci_host_bridge *bridge;
struct mobiveil_pcie *mv_pci;
struct ls_g4_pcie *pcie;
- struct device_node *np = dev->of_node;
+ struct device_node *np = dev->of_node, *parse_np;
int ret;
- if (!of_parse_phandle(np, "msi-parent", 0)) {
+ parse_np = of_parse_phandle(np, "msi-parent", 0);
+ if (!parse_np) {
dev_err(dev, "Failed to find msi-parent\n");
return -EINVAL;
}
+ of_node_put(parse_np);
bridge = devm_pci_alloc_host_bridge(dev, sizeof(*pcie));
if (!bridge)
--
2.25.1
next reply other threads:[~2022-07-04 6:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-04 6:26 Liang He [this message]
2022-07-14 16:37 ` [PATCH] pci: controller: mobiveil: Hold reference returned by of_parse_phandle() Bjorn Helgaas
2022-07-15 0:06 ` Liang He
2022-07-15 23:03 ` Bjorn Helgaas
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=20220704062608.273440-1-windhl@126.com \
--to=windhl@126.com \
--cc=Zhiqiang.Hou@nxp.com \
--cc=bhelgaas@google.com \
--cc=kw@linux.com \
--cc=linmq006@gmail.com \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=robh@kernel.org \
/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).