* [PATCH v2] leds: lp5860: fix init error-path locking
@ 2026-07-20 10:48 kr494167
2026-08-06 12:32 ` Lee Jones
0 siblings, 1 reply; 2+ messages in thread
From: kr494167 @ 2026-07-20 10:48 UTC (permalink / raw)
To: lee, pavel; +Cc: s.trumtrar, linux-leds, linux-kernel, surendra
From: surendra <kr494167@gmail.com>
lp5860_device_init() unlocks lp->lock after updating the device mode.
An lp5860_init_dt() failure then jumps to err_disable, which attempts to
unlock the mutex a second time before disabling the chip.
Unlock immediately after the register update and keep the common error
handler lockless.
Fixes: f0a66563aa2d ("leds: Add support for TI LP5860 LED driver chip")
Signed-off-by: surendra <kr494167@gmail.com>
---
drivers/leds/rgb/leds-lp5860-core.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/leds/rgb/leds-lp5860-core.c b/drivers/leds/rgb/leds-lp5860-core.c
index fd0e2f6e6e0f..e21d5f2302be 100644
--- a/drivers/leds/rgb/leds-lp5860-core.c
+++ b/drivers/leds/rgb/leds-lp5860-core.c
@@ -204,9 +204,9 @@ int lp5860_device_init(struct device *dev)
mutex_lock(&lp->lock);
ret = regmap_update_bits(lp->regmap, LP5860_REG_DEV_INITIAL, LP5860_MODE_MASK,
LP5860_MODE_1 << LP5860_MODE_SHIFT);
+ mutex_unlock(&lp->lock);
if (ret)
goto err_disable;
- mutex_unlock(&lp->lock);
ret = lp5860_init_dt(lp);
if (ret)
@@ -215,7 +215,6 @@ int lp5860_device_init(struct device *dev)
return 0;
err_disable:
- mutex_unlock(&lp->lock);
lp5860_chip_enable(lp, LP5860_CHIP_DISABLE);
return ret;
}
--
2.55.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] leds: lp5860: fix init error-path locking
2026-07-20 10:48 [PATCH v2] leds: lp5860: fix init error-path locking kr494167
@ 2026-08-06 12:32 ` Lee Jones
0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2026-08-06 12:32 UTC (permalink / raw)
To: kr494167; +Cc: pavel, s.trumtrar, linux-leds, linux-kernel
On Mon, 20 Jul 2026, kr494167@gmail.com wrote:
> From: surendra <kr494167@gmail.com>
>
> lp5860_device_init() unlocks lp->lock after updating the device mode.
> An lp5860_init_dt() failure then jumps to err_disable, which attempts to
> unlock the mutex a second time before disabling the chip.
>
> Unlock immediately after the register update and keep the common error
> handler lockless.
>
> Fixes: f0a66563aa2d ("leds: Add support for TI LP5860 LED driver chip")
>
> Signed-off-by: surendra <kr494167@gmail.com>
Full names in SoBs please.
> ---
> drivers/leds/rgb/leds-lp5860-core.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/leds/rgb/leds-lp5860-core.c b/drivers/leds/rgb/leds-lp5860-core.c
> index fd0e2f6e6e0f..e21d5f2302be 100644
> --- a/drivers/leds/rgb/leds-lp5860-core.c
> +++ b/drivers/leds/rgb/leds-lp5860-core.c
> @@ -204,9 +204,9 @@ int lp5860_device_init(struct device *dev)
> mutex_lock(&lp->lock);
> ret = regmap_update_bits(lp->regmap, LP5860_REG_DEV_INITIAL, LP5860_MODE_MASK,
> LP5860_MODE_1 << LP5860_MODE_SHIFT);
> + mutex_unlock(&lp->lock);
> if (ret)
> goto err_disable;
> - mutex_unlock(&lp->lock);
>
> ret = lp5860_init_dt(lp);
> if (ret)
> @@ -215,7 +215,6 @@ int lp5860_device_init(struct device *dev)
> return 0;
>
> err_disable:
> - mutex_unlock(&lp->lock);
> lp5860_chip_enable(lp, LP5860_CHIP_DISABLE);
> return ret;
> }
> --
> 2.55.0
--
Lee Jones
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-06 12:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-20 10:48 [PATCH v2] leds: lp5860: fix init error-path locking kr494167
2026-08-06 12:32 ` Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox