mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 21:48:54 +02:00
leds: lp5860: Fix a potential double-unlock
In lp5860_device_init(), if lp5860_init_dt() fails, an already unlocked
mutex is unlocked another time.
Slightly rework how the lock is taken/released to avoid this potential
double unlock.
Fixes: f0a66563aa ("leds: Add support for TI LP5860 LED driver chip")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://patch.msgid.link/0f4d556e0532bfa881d7d83c1e244572117a89e3.1781970674.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Lee Jones <lee@kernel.org>
This commit is contained in:
parent
7ddc04d1bd
commit
10a5a70c02
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user