Re: [PATCH] clk: microchip: mpfs: fix regmap_update_bits() mask/val order

Conor Dooley <[email protected]>
Newsgroups org.infradead.lists.linux-riscv,org.kernel.vger.linux-clk,org.kernel.vger.linux-kernel
Message-ID <20260814-boggle-derby-3f55c6c14bc8@spud>
On Fri, Aug 14, 2026 at 10:22:13AM +0100, Pedro Kopper wrote:
> mpfs_cfg_clk_set_rate() passes the mask and value arguments to
> regmap_update_bits() in the wrong order. The resulting write becomes
> reg = orig_reg | val, causing bits to not be cleared if the clock
> divider changes.
> 
> Pass the arguments in the correct order so the divider field is updated
> as intended.
> 
> Fixes: c6f2dddfa7f9 ("clk: microchip: mpfs: use regmap for clocks")
> Signed-off-by: Pedro Kopper <[email protected]>

CC: [email protected]
Reviewed-by: Conor Dooley <[email protected]>

Cheers,
Conor.

> ---
>  drivers/clk/microchip/clk-mpfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/microchip/clk-mpfs.c b/drivers/clk/microchip/clk-mpfs.c
> index ee58304913ef..7f044775aea8 100644
> --- a/drivers/clk/microchip/clk-mpfs.c
> +++ b/drivers/clk/microchip/clk-mpfs.c
> @@ -285,7 +285,7 @@ static int mpfs_cfg_clk_set_rate(struct clk_hw *hw, unsigned long rate, unsigned
>  
>  	mask = clk_div_mask(cfg->width) << cfg->shift;
>  	val = divider_setting << cfg->shift;
> -	regmap_update_bits(cfg->map, cfg->map_offset, val, mask);
> +	regmap_update_bits(cfg->map, cfg->map_offset, mask, val);
>  
>  	return 0;
>  }
> -- 
> 2.43.0
>

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
signature.asc (application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE-----

iHUEABYKAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCan8yuAAKCRB4tDGHoIJi
0szbAP4r5lkjOU05Z8OBHNcjRlUP+5eVU0Y+j/1qqkhgJWDo7wEApBkqLMPNQqSc
2hBKFESwyLLmkFM/+GEkcYTvKY/U6Ak=
=Po1h
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.