Re: [PATCH] regcache: Warn if regcache_sync() is called in cache_only mode
From: Mark Brown
Date: Wed Jul 15 2026 - 08:45:23 EST
On Wed, Jul 15, 2026 at 12:21:00PM +0700, phucduc.bui@xxxxxxxxx wrote:
> @@ -411,6 +415,9 @@ int regcache_sync(struct regmap *map)
> if (WARN_ON(map->cache_type == REGCACHE_NONE))
> return -EINVAL;
>
> + if (WARN_ON(map->cache_only))
> + return -EINVAL;
> +
> BUG_ON(!map->cache_ops);
>
> map->lock(map->lock_arg);
The check needs to be done under lock otherwise some other thread could
come in and put the regmap into cache only mode between the check and
when we take the lock.
We also need a similar check in regcache_sync_region().
Attachment:
signature.asc
Description: PGP signature