regmap: Fix for v7.1

Some other fixing in an API user turned up the fact that we weren't
 correctly applying cache only mode to volatile registers in
 regmap_update_bits(), causing us to try to access hardware that was
 powered off or otherwise not in a state to accept I/O.  This fix returns
 an error instead, avoiding more serious consequences.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmoZyXsACgkQJNaLcl1U
 h9DJZgf/aOLHE/EBIBcq9QBczGj5Js2/diVO4YCR0WGISbYv4tRfhwkO5SMyPFZ0
 Zk7c9rfzEqauQW3tpsPUhg/B5gK6HOZ/gIAZA7+CjmLCDxg2EBxclFFnl7UKWt8d
 Xs5YdokBL4ZrlVBtgL3YerQ4dCSiDr6FLZYAnFWy5FLXkNbwqvxhUzc7LzAnY/Z3
 pLw/LOnSc1LwXhf10gCKI8OoHdQSPu0pNr9ZYG1smD1J/K9V9Pgbdq0oLrGquwB1
 F8mIFdncblhW4ChbWDUxhF26htKpv4qwdjWKdkHlNDXAYPrS70Ea2PqVP1XwEWdK
 WxouWVBIpOOqGt0OCYooADmHADJ6VQ==
 =9bVn
 -----END PGP SIGNATURE-----

Merge tag 'regmap-fix-v7.1-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap

Pull regmap fix from Mark Brown:
 "Some other fixing in an API user turned up the fact that we weren't
  correctly applying cache only mode to volatile registers in
  regmap_update_bits(), causing us to try to access hardware that was
  powered off or otherwise not in a state to accept I/O. This fix
  returns an error instead, avoiding more serious consequences"

* tag 'regmap-fix-v7.1-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap:
  regmap: reject volatile update_bits() in cache-only mode
This commit is contained in:
Linus Torvalds 2026-05-29 16:39:56 -07:00
commit 230ff934f7

View File

@ -3257,6 +3257,9 @@ static int _regmap_update_bits(struct regmap *map, unsigned int reg,
*change = false;
if (regmap_volatile(map, reg) && map->reg_update_bits) {
if (map->cache_only)
return -EBUSY;
reg = regmap_reg_addr(map, reg);
ret = map->reg_update_bits(map->bus_context, reg, mask, val);
if (ret == 0 && change)