mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yao Zi <me@ziyao.cc>
To: Ulf Hansson <ulfh@kernel.org>, Heiko Stuebner <heiko@sntech.de>,
	Shawn Lin <shawn.lin@rock-chips.com>,
	Sebastian Reichel <sebastian.reichel@collabora.com>,
	Yao Zi <me@ziyao.cc>, Sergey Shtylyov <s.shtylyov@auroraos.dev>,
	Midgy BALON <midgy971@gmail.com>,
	Finley Xiao <finley.xiao@rock-chips.com>,
	Frank Zhang <rmxpzlb@gmail.com>,
	Chris Morgan <macromorgan@hotmail.com>,
	Kevin Hilman <khilman@linaro.org>,
	Caesar Wang <wxt@rock-chips.com>,
	Elaine Zhang <zhangqing@rock-chips.com>
Cc: linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: [PATCH 1/2] pmdomain: rockchip: Only put clocks that have been successfully obtained
Date: Thu,  5 Nov 2026 00:12:56 +0000	[thread overview]
Message-ID: <20261105001257.1368266-2-me@ziyao.cc> (raw)
In-Reply-To: <20261105001257.1368266-1-me@ziyao.cc>

Since pd->num_clks represents the number of clocks described in
devicetree, invoking clk_bulk_put() with it will put invalid pointers
when some clocks cannot be obtained, triggering a warning in CCF like,

  WARNING: drivers/clk/clk.c:4844 at __clk_put+0xf8/0x12c, CPU#0: swapper/0/1
  Call trace:
    __clk_put+0xf8/0x12c (P)
    clk_put+0x10/0x20
    clk_bulk_put+0x38/0x60
    rockchip_pm_add_one_domain+0x2b0/0x468
    rockchip_pm_domain_probe+0xd4/0x2f0
    platform_probe+0x80/0xac
    ...

Invoke clk_bulk_put() with the counter used in the loop of obtaining
clocks instead.

Fixes: d8b384777066 ("pmdomain: rockchip: fix clock leak on domain probe failure")
Signed-off-by: Yao Zi <me@ziyao.cc>
Cc: stable@vger.kernel.org
---
 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 db3879846db6..34c862e56aad 100644
--- a/drivers/pmdomain/rockchip/pm-domains.c
+++ b/drivers/pmdomain/rockchip/pm-domains.c
@@ -931,7 +931,7 @@ static int rockchip_pm_add_one_domain(struct rockchip_pmu *pmu,
 err_unprepare_clocks:
 	clk_bulk_unprepare(pd->num_clks, pd->clks);
 err_put_clocks:
-	clk_bulk_put(pd->num_clks, pd->clks);
+	clk_bulk_put(i, pd->clks);
 	return error;
 }
 
-- 
2.56.0


  reply	other threads:[~2026-11-05  0:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05  0:12 [PATCH 0/2] Error and deferred probe fixes to Rockchip PM domain driver Yao Zi
2026-11-05  0:12 ` Yao Zi [this message]
2026-11-05  0:12 ` [PATCH 2/2] pmdomain: rockchip: Don't log when of_clk_get() fails with -EPROBE_DEFER Yao Zi
2026-11-05 20:47   ` Sergey Shtylyov

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=20261105001257.1368266-2-me@ziyao.cc \
    --to=me@ziyao.cc \
    --cc=finley.xiao@rock-chips.com \
    --cc=heiko@sntech.de \
    --cc=khilman@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=macromorgan@hotmail.com \
    --cc=midgy971@gmail.com \
    --cc=rmxpzlb@gmail.com \
    --cc=s.shtylyov@auroraos.dev \
    --cc=sebastian.reichel@collabora.com \
    --cc=shawn.lin@rock-chips.com \
    --cc=stable@vger.kernel.org \
    --cc=ulfh@kernel.org \
    --cc=wxt@rock-chips.com \
    --cc=zhangqing@rock-chips.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®