From: Fenglin Wu <fenglin.wu@oss.qualcomm.com>
To: Jie Gan <jie.gan@oss.qualcomm.com>,
linux-arm-msm@vger.kernel.org, Stephen Boyd <sboyd@kernel.org>,
Neil Armstrong <neil.armstrong@linaro.org>,
Abel Vesa <abelvesa@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: David Collins <david.collins@oss.qualcomm.com>,
Subbaraman Narayanamurthy
<subbaraman.narayanamurthy@oss.qualcomm.com>,
Kamal Wadhwa <kamal.wadhwa@oss.qualcomm.com>,
kernel@oss.qualcomm.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] spmi: pmic-arb: Fix OF node leak in spmi_pmic_arb_register_buses()
Date: Fri, 5 Jun 2026 15:46:53 +0800 [thread overview]
Message-ID: <c52f5cdf-8795-4dcb-917d-f2a790559f74@oss.qualcomm.com> (raw)
In-Reply-To: <b417d35d-68f8-4900-9a83-16c66983fdbf@oss.qualcomm.com>
On 6/5/2026 2:15 PM, Jie Gan wrote:
>
>
> On 6/5/2026 1:46 PM, Fenglin Wu wrote:
>> Call of_node_put(child) to reduce its reference count when
>> bailing out from the for_each_available_child_of_node() loop
>> upon an error in bus registration.
>>
>> Also, return 0 directly if there are no errors in bus
>> registration.
>>
>> Fixes: 979987371739 ("spmi: pmic-arb: Add multi bus support")
>> Signed-off-by: Fenglin Wu <fenglin.wu@oss.qualcomm.com>
>> ---
>> drivers/spmi/spmi-pmic-arb.c | 6 ++++--
>> 1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c
>> index 2e2cb4774103..26e804ad95a1 100644
>> --- a/drivers/spmi/spmi-pmic-arb.c
>> +++ b/drivers/spmi/spmi-pmic-arb.c
>> @@ -2055,12 +2055,14 @@ static int
>> spmi_pmic_arb_register_buses(struct spmi_pmic_arb *pmic_arb,
>> for_each_available_child_of_node_scoped(node, child) {
>> if (of_node_name_eq(child, "spmi")) {
>> ret = spmi_pmic_arb_bus_init(pdev, child, pmic_arb);
>> - if (ret)
>> + if (ret) {
>> + of_node_put(child);
>
> We dont need of_node_put here. The
> for_each_available_child_of_node_scoped will handle the refcnt
> automatically.
>
> Thanks,
> Jie
Ahh, thanks for pointing out. Just trying to send a patch which was
applied in our downstream code base. I didn't notice this was fixed on
the tip.
Anyway, still need to fix the minor one on the "ret" value
initialization. Will resend.
>
>> return ret;
>> + }
>> }
>> }
>> - return ret;
>> + return 0;
>> }
>> static void spmi_pmic_arb_deregister_buses(struct spmi_pmic_arb
>> *pmic_arb)
>>
>> ---
>> base-commit: 3443eec9c55d128064c83225a9111f1a1a37277a
>> change-id: 20260604-spmi-bus-register-fix-dfdb94bf834e
>>
>> Best regards,
>> --
>> Fenglin Wu <fenglin.wu@oss.qualcomm.com>
>>
>
prev parent reply other threads:[~2026-06-05 7:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-05 5:46 Fenglin Wu
2026-06-05 6:06 ` Greg Kroah-Hartman
2026-06-05 6:15 ` Jie Gan
2026-06-05 7:46 ` Fenglin Wu [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=c52f5cdf-8795-4dcb-917d-f2a790559f74@oss.qualcomm.com \
--to=fenglin.wu@oss.qualcomm.com \
--cc=abelvesa@kernel.org \
--cc=david.collins@oss.qualcomm.com \
--cc=gregkh@linuxfoundation.org \
--cc=jie.gan@oss.qualcomm.com \
--cc=kamal.wadhwa@oss.qualcomm.com \
--cc=kernel@oss.qualcomm.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=sboyd@kernel.org \
--cc=subbaraman.narayanamurthy@oss.qualcomm.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®