mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Anton Protopopov <a.s.protopopov@gmail.com>
To: "Vignesh Raghavendra" <vigneshr@ti.com>,
	"Siddharth Vadapalli" <s-vadapalli@ti.com>,
	"Manivannan Sadhasivam" <mani@kernel.org>,
	"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Rob Herring" <robh@kernel.org>, "Aksh Garg" <a-garg7@ti.com>,
	linux-pci@vger.kernel.org, linux-omap@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Cc: Anton Protopopov <a.s.protopopov@gmail.com>
Subject: [PATCH v2 2/2] PCI: j721e: Put the syscon nodes after parsing their arguments
Date: Tue,  1 Dec 2026 11:34:24 +0000	[thread overview]
Message-ID: <20261201113427.342670-2-a.s.protopopov@gmail.com> (raw)
In-Reply-To: <20261201113427.342670-1-a.s.protopopov@gmail.com>

The of_parse_phandle_with_fixed_args() function returns the node in
args.np with a reference. The j721e_pcie_ctrl_init() and
j721e_enable_acspcie_refclk() functions use only the argument and
never put the node. The j721e_pcie_ctrl_init() function runs on each
attempt to probe and on each resume, so every system resume leaks
one or two node references. Put the nodes after reading the
arguments.

Fixes: 7aa256234c4c ("PCI: j721e: Get offset within "syscon" from "ti,syscon-pcie-ctrl" phandle arg")
Fixes: 82c4be4168e2 ("PCI: j721e: Enable ACSPCIE Refclk if "ti,syscon-acspcie-proxy-ctrl" exists")
Signed-off-by: Anton Protopopov <a.s.protopopov@gmail.com>
---
 drivers/pci/controller/cadence/pci-j721e.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/controller/cadence/pci-j721e.c b/drivers/pci/controller/cadence/pci-j721e.c
index fdae51e368e0..a82e208cb6bc 100644
--- a/drivers/pci/controller/cadence/pci-j721e.c
+++ b/drivers/pci/controller/cadence/pci-j721e.c
@@ -256,6 +256,7 @@ static int j721e_enable_acspcie_refclk(struct j721e_pcie *pcie,
 
 	/* Clear PAD IO disable bits to enable refclk output */
 	val = ~(args.args[0]);
+	of_node_put(args.np);
 	ret = regmap_update_bits(syscon, 0, mask, val);
 	if (ret) {
 		dev_err(dev, "failed to enable ACSPCIE refclk: %d\n", ret);
@@ -283,8 +284,10 @@ static int j721e_pcie_ctrl_init(struct j721e_pcie *pcie)
 	/* Do not error out to maintain old DT compatibility */
 	ret = of_parse_phandle_with_fixed_args(node, "ti,syscon-pcie-ctrl", 1,
 					       0, &args);
-	if (!ret)
+	if (!ret) {
 		offset = args.args[0];
+		of_node_put(args.np);
+	}
 
 	/*
 	 * The PCIe Controller's registers have different "reset-values"

      reply	other threads:[~2026-12-01 11:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 11:34 [PATCH v2 1/2] PCI: j721e: Check the error of the ACSPCIE syscon lookup Anton Protopopov
2026-12-01 11:34 ` Anton Protopopov [this message]

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=20261201113427.342670-2-a.s.protopopov@gmail.com \
    --to=a.s.protopopov@gmail.com \
    --cc=a-garg7@ti.com \
    --cc=bhelgaas@google.com \
    --cc=kwilczynski@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mani@kernel.org \
    --cc=robh@kernel.org \
    --cc=s-vadapalli@ti.com \
    --cc=vigneshr@ti.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

all inboxes | Powered by JetHome®