mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Alexis Lothoré" <alexis.lothore@bootlin.com>
To: Ulf Hansson <ulfh@kernel.org>, Heiko Stuebner <heiko@sntech.de>,
	 Sebastian Reichel <sebastian.reichel@collabora.com>,
	 Shawn Lin <shawn.lin@rock-chips.com>
Cc: "Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
	linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
	"Alexis Lothoré" <alexis.lothore@bootlin.com>
Subject: [PATCH] pmdomain: rockchip: fix warning when deferring probe
Date: Sun, 22 Nov 2026 14:37:40 +0100	[thread overview]
Message-ID: <20261122-rockchip-pm-defer-v1-1-5b41635e3410@bootlin.com> (raw)

When the PMU probe fails because a clock can't be acquired, the
pm-domains driver raises a warning in kernel logs:

  [...] power-domain: failed to get clk at index 0: -517
  ------------[ cut here ]------------
  WARNING: drivers/clk/clk.c:4831 at __clk_put+0xf8/0x130, CPU#0: swapper/0/1
  Modules linked in:
  CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Not tainted 7.3.5-00004-g552d0d1e09f2 #103 PREEMPT
  Hardware name: FriendlyElec NanoPi Zero2 (DT)
  pstate: 20000005 (nzCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
  pc : __clk_put+0xf8/0x130
  lr : clk_put+0x10/0x20
  sp : ffff80008192b750
  x29: ffff80008192b750 x28: ffff80008147aee0 x27: ffff8000813400bc
  x26: 0000000000000000 x25: ffff800080e5d5c0 x24: ffff00000074f280
  x23: ffff00007fbe6bc8 x22: 0000000000000000 x21: 0000000000000000
  x20: ffff0000004f78b0 x19: fffffffffffffdfb x18: 0000000000000006
  x17: 70203a72656c6c6f x16: 72746e6f632d7265 x15: 0720075207450746
  x14: 07450744075f0745 x13: 0720075207450746 x12: ffff8000816ee830
  x11: 0000000000000058 x10: 0000000000000018 x9 : ffff8000816ee830
  x8 : 000000000000005d x7 : 3ffffffffffff000 x6 : ffff800081746830
  x5 : 0000000000017fe8 x4 : 0000000000000000 x3 : ffff0000004f78b0
  x2 : 0000000000000010 x1 : ffff0000004f78c0 x0 : fffffffffffffdfb
  Call trace:
   __clk_put+0xf8/0x130 (P)
   clk_put+0x10/0x20
   clk_bulk_put+0x3c/0x60
   rockchip_pm_add_one_domain+0x298/0x4a0
   rockchip_pm_domain_probe+0xd4/0x310
   platform_probe+0x5c/0xb0
   really_probe+0xc0/0x3e0
   __driver_probe_device+0x164/0x1d0
   driver_probe_device+0xb4/0x120
   __device_attach_driver+0xbc/0x190
   bus_for_each_drv+0x88/0xf0
   __device_attach+0xa0/0x1e0
   device_initial_probe+0x50/0x70
   __bus_probe_device+0x38/0xb0
   bus_probe_device+0x10/0x20
   device_add+0x604/0x850
   of_device_add+0x44/0x60
   of_platform_device_create_pdata+0x94/0x160
   of_platform_bus_create+0x198/0x520
   of_platform_bus_create+0x1f8/0x520
   of_platform_bus_create+0x1f8/0x520
   of_platform_populate+0x58/0x170
   of_platform_default_populate_init+0xe8/0x100
   do_one_initcall+0x60/0x1d0
   kernel_init_freeable+0x204/0x288
   kernel_init+0x2c/0x130
   ret_from_fork+0x10/0x20
  ---[ end trace 0000000000000000 ]---

The warning is due to rockchip_pm_add_one_domain passing pd->num_clks to
clk_bulk_put, but pd->num_clks does not reflect correctly how many
clocks are correctly acquired (it is systematically set to the _known_
number of clocks, before attempting to get them).

Only pass the number of retrieved clocks to clk_bulk_put by setting
pd->num_clks to the number of correctly processed clocks. The value will
be dropped anyway in case of failed probe.

Fixes: d8b384777066 ("pmdomain: rockchip: fix clock leak on domain probe failure")
Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
---
 drivers/pmdomain/rockchip/pm-domains.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pmdomain/rockchip/pm-domains.c b/drivers/pmdomain/rockchip/pm-domains.c
index e193f978d5f3..adc3bebcd928 100644
--- a/drivers/pmdomain/rockchip/pm-domains.c
+++ b/drivers/pmdomain/rockchip/pm-domains.c
@@ -854,6 +854,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);
+			pd->num_clks = i;
 			goto err_put_clocks;
 		}
 	}

---
base-commit: 988117cc1bb17338c586a4e21ade88b5397eac33
change-id: 20261122-rockchip-pm-defer-adb33313f110

Best regards,
--  
Alexis Lothoré <alexis.lothore@bootlin.com>


             reply	other threads:[~2026-11-22 13:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-22 13:37 Alexis Lothoré [this message]
2026-11-26 12:43 ` Ulf Hansson
2026-11-26 13:36   ` Alexis Lothoré

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=20261122-rockchip-pm-defer-v1-1-5b41635e3410@bootlin.com \
    --to=alexis.lothore@bootlin.com \
    --cc=heiko@sntech.de \
    --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=sebastian.reichel@collabora.com \
    --cc=shawn.lin@rock-chips.com \
    --cc=thomas.petazzoni@bootlin.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

all inboxes | Powered by JetHome®