Linux-Rockchip Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Shawn Lin <shawn.lin@rock-chips.com>
To: Sebastian Reichel <sebastian.reichel@collabora.com>
Cc: shawn.lin@rock-chips.com, Ulf Hansson <ulfh@kernel.org>,
	Heiko Stuebner <heiko@sntech.de>,
	linux-pm@vger.kernel.org, linux-rockchip@lists.infradead.org
Subject: Re: [PATCH 2/4] pmdomain: rockchip: fix clock leak on domain probe failure
Date: Sun, 20 Sep 2026 09:15:52 +0800	[thread overview]
Message-ID: <3fa0fcbc-b6ff-4934-bb7d-b763d6f5f818@rock-chips.com> (raw)
In-Reply-To: <27e3944f-81c6-48e4-8033-e30ae70f8e26@rock-chips.com>

Hi Sebastian

在 2026/09/19 星期六 8:13, Shawn Lin 写道:
> Hi Sebastian
> 
> 在 2026/09/19 星期六 1:21, Sebastian Reichel 写道:
>> Hi,
>>
>> On Fri, Sep 18, 2026 at 08:07:36PM +0800, Shawn Lin wrote:
>>> When of_clk_get() failed in the middle of the loop, the references of
>>> the clocks acquired so far were leaked instead of being released by
>>> the error path.
>>>
>>> Fixes: d909072d0521 ("soc: rockchip: power-domain: use clk_bulk APIs")
>>> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
>>> ---
>>
>> Right, but this should switch
>>
>> pd->clks = devm_kcalloc(...);
>>
>> to
>>
>> pd->clks = devm_kzalloc(...);
>>
>> at the same time to ensure that clk_bulk_put() does not run over
>> non-initialized data. Otherwise
> 
> Good catch, will improve it in v2.
> 

I was too quick to response, but didn't looked into devm_kcalloc, just
guess it didn't zero the data from the name. However it does zero the
data by passing in __GFP_ZERO. So I need to respin v3 and drop
devm_kzalloc change.


> Thanks.
> 
>>
>> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
>>
>> Greetings,
>>
>> -- Sebastian
>>
>>>
>>>   drivers/pmdomain/rockchip/pm-domains.c | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/pmdomain/rockchip/pm-domains.c b/drivers/ 
>>> pmdomain/rockchip/pm-domains.c
>>> index 068dd4b3..b6b099b 100644
>>> --- a/drivers/pmdomain/rockchip/pm-domains.c
>>> +++ b/drivers/pmdomain/rockchip/pm-domains.c
>>> @@ -842,7 +842,7 @@ static int rockchip_pm_add_one_domain(struct 
>>> rockchip_pmu *pmu,
>>>               dev_err(pmu->dev,
>>>                   "%pOFn: failed to get clk at index %d: %d\n",
>>>                   node, i, error);
>>> -            return error;
>>> +            goto err_put_clocks;
>>>           }
>>>       }
>>> -- 
>>> 2.7.4
>>>
>>>
> 
> 


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

  reply	other threads:[~2026-09-20  1:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-18 12:07 [PATCH 0/4] Small fixes and improvement for Rockchip pm-domains driver Shawn Lin
2026-09-18 12:07 ` [PATCH 1/4] pmdomain: rockchip: propagate subdomain add errors Shawn Lin
2026-09-18 17:18   ` Sebastian Reichel
2026-09-18 12:07 ` [PATCH 2/4] pmdomain: rockchip: fix clock leak on domain probe failure Shawn Lin
2026-09-18 17:21   ` Sebastian Reichel
2026-09-19  0:13     ` Shawn Lin
2026-09-20  1:15       ` Shawn Lin [this message]
2026-09-22 14:46         ` Sebastian Reichel
2026-09-18 12:07 ` [PATCH 3/4] pmdomain: rockchip: don't ignore clock lookup errors on attach Shawn Lin
2026-09-18 17:59   ` Sebastian Reichel
2026-09-18 12:07 ` [PATCH 4/4] pmdomain: rockchip: drop duplicated errno from supply failure message Shawn Lin
2026-09-18 17:54   ` Sebastian Reichel

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=3fa0fcbc-b6ff-4934-bb7d-b763d6f5f818@rock-chips.com \
    --to=shawn.lin@rock-chips.com \
    --cc=heiko@sntech.de \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=sebastian.reichel@collabora.com \
    --cc=ulfh@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