Skip to content

Commit 002679f

Browse files
ISCAS-VulabLinus Walleij
authored andcommitted
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: 97cfb6c ("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>
1 parent f9f4fda commit 002679f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/pinctrl/stm32/pinctrl-stm32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1872,7 +1872,7 @@ int stm32_pctl_probe(struct platform_device *pdev)
18721872
if (hwlock_id == -EPROBE_DEFER)
18731873
return hwlock_id;
18741874
} else {
1875-
pctl->hwlock = hwspin_lock_request_specific(hwlock_id);
1875+
pctl->hwlock = devm_hwspin_lock_request_specific(dev, hwlock_id);
18761876
}
18771877

18781878
spin_lock_init(&pctl->irqmux_lock);

0 commit comments

Comments
 (0)