[PATCH] pmdomain: rockchip: fix warning when deferring probe

From: Alexis Lothoré

Date: Sun Nov 22 2026 - 08:38:01 EST


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@xxxxxxxxxxx>
---
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@xxxxxxxxxxx>