mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 09:04:39 +02:00
pinctrl: stm32: fix hwspinlock resource leak in probe function
In stm32_pctl_probe(), hwspin_lock_request_specific() is called to
request a hwspinlock, but the acquired lock is not freed on multiple
error paths after this call. This causes resource leakage when the
function fails to initialize properly.
Use devm_hwspin_lock_request_specific() instead of
hwspin_lock_request_specific() to automatically manage the hwspinlock
resource lifecycle.
Fixes: 97cfb6cd34 ("pinctrl: stm32: protect configuration registers with a hwspinlock")
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
Reviewed-by: Antonio Borneo <antonio.borneo@foss.st.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
f9f4fda15e
commit
002679f79e
|
|
@ -1872,7 +1872,7 @@ int stm32_pctl_probe(struct platform_device *pdev)
|
|||
if (hwlock_id == -EPROBE_DEFER)
|
||||
return hwlock_id;
|
||||
} else {
|
||||
pctl->hwlock = hwspin_lock_request_specific(hwlock_id);
|
||||
pctl->hwlock = devm_hwspin_lock_request_specific(dev, hwlock_id);
|
||||
}
|
||||
|
||||
spin_lock_init(&pctl->irqmux_lock);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user