[PATCH] pmdomain: bcm: bcm2835-power: Fix broken reset status read

Ulf Hansson ulf.hansson at linaro.org
Fri Feb 27 09:11:34 PST 2026


On Thu, 12 Feb 2026 at 16:02, Maíra Canal <mcanal at igalia.com> wrote:
>
> bcm2835_reset_status() has a misplaced parenthesis on every PM_READ()
> call. Since PM_READ(reg) expands to readl(power->base + (reg)), the
> expression:
>
>     PM_READ(PM_GRAFX & PM_V3DRSTN)
>
> computes the bitwise AND of the register offset PM_GRAFX with the
> bitmask PM_V3DRSTN before using the result as a register offset, reading
> from the wrong MMIO address instead of the intended PM_GRAFX register.
> The same issue affects the PM_IMAGE cases.
>
> Fix by moving the closing parenthesis so PM_READ() receives only the
> register offset, and the bitmask is applied to the value returned by
> the read.
>
> Fixes: 670c672608a1 ("soc: bcm: bcm2835-pm: Add support for power domains under a new binding.")
> Signed-off-by: Maíra Canal <mcanal at igalia.com>

Applied fixes and added a stable tag, thanks!

Kind regards
Uffe


> ---
>
> Hi,
>
> Most likely this bug went unnoticed as there is no in-tree driver
> currently calling reset_control_status() on the BCM2835 reset
> controller. Although I'm sending a fix to the .status callback, another
> possibility would be removing the implementation of this callback
> considering that (1) it's broken and (2) it's not used.
>
> I'd appreciate your feedback about the most suitable option.
>
> Best regards,
> - Maíra
>
> ---
>
>  drivers/pmdomain/bcm/bcm2835-power.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pmdomain/bcm/bcm2835-power.c b/drivers/pmdomain/bcm/bcm2835-power.c
> index 1d29addfe036..0450202bbee2 100644
> --- a/drivers/pmdomain/bcm/bcm2835-power.c
> +++ b/drivers/pmdomain/bcm/bcm2835-power.c
> @@ -580,11 +580,11 @@ static int bcm2835_reset_status(struct reset_controller_dev *rcdev,
>
>         switch (id) {
>         case BCM2835_RESET_V3D:
> -               return !PM_READ(PM_GRAFX & PM_V3DRSTN);
> +               return !(PM_READ(PM_GRAFX) & PM_V3DRSTN);
>         case BCM2835_RESET_H264:
> -               return !PM_READ(PM_IMAGE & PM_H264RSTN);
> +               return !(PM_READ(PM_IMAGE) & PM_H264RSTN);
>         case BCM2835_RESET_ISP:
> -               return !PM_READ(PM_IMAGE & PM_ISPRSTN);
> +               return !(PM_READ(PM_IMAGE) & PM_ISPRSTN);
>         default:
>                 return -EINVAL;
>         }
> --
> 2.52.0
>



More information about the linux-arm-kernel mailing list