]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
pinctrl: stm32: fix hwspinlock resource leak in probe function
authorHaotian Zhang <vulab@iscas.ac.cn>
Wed, 29 Oct 2025 01:42:52 +0000 (09:42 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Dec 2025 12:54:50 +0000 (13:54 +0100)
commit6b860ae7cd95d5b7c71fae8436029c0fc02afb19
tree43b229a669e5fbf2bbbe275ac69b13abd91ae84a
parent60d1c1d4d92583bf9614cd2e2368b2466c962a21
pinctrl: stm32: fix hwspinlock resource leak in probe function

[ Upstream commit 002679f79ed605e543fbace465557317cd307c9a ]

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: 97cfb6cd34f2 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/pinctrl/stm32/pinctrl-stm32.c