Re: [PATCH] regmap: Fix race condition in hwspinlock irqsave routine

From: Mark Brown

Date: Tue Jan 06 2026 - 07:27:39 EST


On Tue, Jan 06, 2026 at 10:15:01AM +0800, Yu-Chun Lin wrote:

> static void regmap_lock_hwlock_irqsave(void *__map)
> {
> struct regmap *map = __map;
> + unsigned long flags;
>
> hwspin_lock_timeout_irqsave(map->hwlock, UINT_MAX,
> - &map->spinlock_flags);
> + &flags);
> + map->spinlock_flags = flags;

This breaks a -Werror build:

/build/stage/linux/drivers/base/regmap/regmap.c: In function ‘regmap_lock_hwlock_irqsave’:
/build/stage/linux/drivers/base/regmap/regmap.c:415:29: error: ‘flags’ is used uninitialized [-Werror=uninitialized]
415 | map->spinlock_flags = flags;
| ~~~~~~~~~~~~~~~~~~~~^~~~~~~
/build/stage/linux/drivers/base/regmap/regmap.c:411:23: note: ‘flags’ was declared here
411 | unsigned long flags;
| ^~~~~

Attachment: signature.asc
Description: PGP signature