From: Mark Rutland <mark.rutland@arm.com>
To: Sudeep Holla <sudeep.holla@arm.com>
Cc: Miaoqian Lin <linmq006@gmail.com>, Gavin Shan <gshan@redhat.com>,
Lorenzo Pieralisi <lpieralisi@kernel.org>,
Will Deacon <will@kernel.org>, Hanjun Guo <guohanjun@huawei.com>,
Catalin Marinas <catalin.marinas@arm.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] firmware: psci: Fix refcount leak in psci_dt_init
Date: Wed, 19 Mar 2025 11:12:02 +0000 [thread overview]
Message-ID: <Z9qmglbXw0xILaet@J2N7QTR9R3> (raw)
In-Reply-To: <Z9qgmTbeLh0cCULw@bogus>
On Wed, Mar 19, 2025 at 10:46:49AM +0000, Sudeep Holla wrote:
> On Wed, Mar 19, 2025 at 08:28:38PM +1000, Gavin Shan wrote:
> Any reason why we can't move to the new scoped usage like below?
> diff --git i/drivers/firmware/psci/psci.c w/drivers/firmware/psci/psci.c
> index a1ebbe9b73b1..a4269078b2a2 100644
> --- i/drivers/firmware/psci/psci.c
> +++ w/drivers/firmware/psci/psci.c
> @@ -797,12 +797,11 @@ static const struct of_device_id psci_of_match[] __initconst = {
>
> int __init psci_dt_init(void)
> {
> - struct device_node *np;
> const struct of_device_id *matched_np;
> psci_initcall_t init_fn;
> int ret;
> -
> - np = of_find_matching_node_and_match(NULL, psci_of_match, &matched_np);
> + struct device_node *np __free(device_node) =
> + of_find_matching_node_and_match(NULL, psci_of_match, &matched_np);
>
> if (!np || !of_device_is_available(np))
> return -ENODEV;
> @@ -810,7 +809,6 @@ int __init psci_dt_init(void)
> init_fn = (psci_initcall_t)matched_np->data;
> ret = init_fn(np);
>
> - of_node_put(np);
> return ret;
> }
IIUC the bug has existed since before the scoped helpers were
introduced, so for the sake of keeping the backport simple I reckon we
should take Miaoqian Lin's patch as-is, and we can consider moving to
the scoped helpers as a later cleanup.
Mark.
next prev parent reply other threads:[~2025-03-19 11:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-18 15:17 [PATCH] firmware: psci: Fix refcount leak in psci_dt_init Miaoqian Lin
2025-03-19 10:28 ` Gavin Shan
2025-03-19 10:46 ` Sudeep Holla
2025-03-19 11:12 ` Mark Rutland [this message]
2025-03-19 11:39 ` Sudeep Holla
2025-03-19 11:23 ` Mark Rutland
2025-03-19 23:30 ` Gavin Shan
2025-04-29 20:27 ` Will Deacon
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=Z9qmglbXw0xILaet@J2N7QTR9R3 \
--to=mark.rutland@arm.com \
--cc=catalin.marinas@arm.com \
--cc=gshan@redhat.com \
--cc=guohanjun@huawei.com \
--cc=linmq006@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=sudeep.holla@arm.com \
--cc=will@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