Linux Power Management development
 help / color / mirror / Atom feed
* [PATCH] pmdomain: rockchip: fix domain check in rockchip_pm_add_one_domain()
@ 2026-09-20 17:59 Sergey Shtylyov
  2026-09-21  6:36 ` Shawn Lin
  2026-09-23 12:14 ` Ulf Hansson
  0 siblings, 2 replies; 11+ messages in thread
From: Sergey Shtylyov @ 2026-09-20 17:59 UTC (permalink / raw)
  To: Ulf Hansson, Heiko Stuebner, linux-pm, linux-rockchip
  Cc: Sergey Shtylyov, Caesar Wang, Kevin Hilman, linux-arm-kernel

In rockchip_pm_add_one_domain(), there's the check (most probably for
the case where the "reg" prop has an unexpected value?) which doesn't
make much sense as the variable pd_info will be NULL iff pmu->info->
domain_info is NULL and the variable id is 0.  What does make sense
there is checking pd_info->pwr_mask and pd_info->req_mask which (as
seems to follow from the code) can't both be 0 for a valid domain...

Found by Linux Verification Center (linuxtesting.org) with the Svace
static analysis tool.

Fixes: 7c696693a4f5 ("soc: rockchip: power-domain: Add power domain driver")
Signed-off-by: Sergey Shtylyov <s.shtylyov@auroraos.dev>

---
This patch is against the fixes branch of Ulf Hansson's linux-pm.git repo.

 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 ba66ae719428..69792e2b215b 100644
--- a/drivers/pmdomain/rockchip/pm-domains.c
+++ b/drivers/pmdomain/rockchip/pm-domains.c
@@ -809,7 +809,7 @@ static int rockchip_pm_add_one_domain(struct rockchip_pmu *pmu,
 		return 0;
 
 	pd_info = &pmu->info->domain_info[id];
-	if (!pd_info) {
+	if (!pd_info->pwr_mask && !pd_info->req_mask) {
 		dev_err(pmu->dev, "%pOFn: undefined domain id %d\n",
 			node, id);
 		return -EINVAL;
-- 
2.55.0

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-09-25 19:38 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-20 17:59 [PATCH] pmdomain: rockchip: fix domain check in rockchip_pm_add_one_domain() Sergey Shtylyov
2026-09-21  6:36 ` Shawn Lin
2026-09-21 16:13   ` Sergey Shtylyov
2026-09-22  0:47     ` Shawn Lin
2026-09-22 16:04       ` Sergey Shtylyov
2026-09-23 12:14 ` Ulf Hansson
2026-09-23 20:38   ` Sergey Shtylyov
2026-09-24  8:48     ` Ulf Hansson
2026-09-24 20:20       ` Sergey Shtylyov
2026-09-23 20:44   ` Sergey Shtylyov
2026-09-25 19:38     ` Sergey Shtylyov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox