Re: [PATCH] clk: renesas: cpg-mssr: Unlock before reset verification

From: Geert Uytterhoeven

Date: Wed Jan 07 2026 - 11:11:34 EST


On Mon, 5 Jan 2026 at 15:06, Prabhakar <prabhakar.csengg@xxxxxxxxx> wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
>
> Move spin_unlock_irqrestore() before verifying the reset result and
> printing errors. The verification condition only uses local variables
> and does not require locking.
>
> Reported-by: Pavel Machek <pavel@xxxxxxxxxxxx>
> Closes: https://lore.kernel.org/all/aVujAQJSDn6WyORK@xxxxxxxxxx/
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>

Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
i.e. will queue in renesas-clk for v6.20.

> --- a/drivers/clk/renesas/renesas-cpg-mssr.c
> +++ b/drivers/clk/renesas/renesas-cpg-mssr.c
> @@ -806,14 +806,12 @@ static int cpg_mrcr_set_reset_state(struct reset_controller_dev *rcdev,
>
> /* Verify the operation */
> val = readl(reg_addr);
> + spin_unlock_irqrestore(&priv->pub.rmw_lock, flags);

I will surround this by blank lines while applying.

> if (set == !(bitmask & val)) {
> dev_err(priv->dev, "Reset register %u%02u operation failed\n", reg, bit);
> - spin_unlock_irqrestore(&priv->pub.rmw_lock, flags);
> return -EIO;
> }
>
> - spin_unlock_irqrestore(&priv->pub.rmw_lock, flags);
> -
> return 0;
> }

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds