[PATCH] pmdomain: rockchip: fix domain check in rockchip_pm_add_one_domain()

Ulf Hansson ulf.hansson at oss.qualcomm.com
Thu Sep 24 01:48:11 PDT 2026


On Wed, Sep 23, 2026 at 10:38 PM Sergey Shtylyov
<s.shtylyov at auroraos.dev> wrote:
>
> On 9/23/26 3:14 PM, Ulf Hansson wrote:
>
> [...]
>
> >> 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 at auroraos.dev>
> >
> > Applied for next, but without the fixes tag, thanks!
> >
> > Note, that I am dropping the fixes tag because if there was a real
> > problem, we would require yet another fix on top to get the
> > corresponding domain declaration to be correct. Yet, the patch is
> > useful as is!
>
>    I'm not sure I understand you. The patch should hopefully be
> enough to detect the undefined entries (implicitly init'ed with
> all 0s). What fix for the domain definitions do you have in mind,
> turning the arrays into lookup tables by adding a domain ID as a
> field to *struct* rockchip_domain_info?

Apologize if I was vague, but you kind of point out what I just said.

The patch helps us to *detect* incorrect entries. If it turns out we
find one, we need to fix that entry.

Kind regards
Uffe



More information about the Linux-rockchip mailing list