Skip to content

Commit 6b860ae

Browse files
ISCAS-Vulabgregkh
authored andcommitted
pinctrl: stm32: fix hwspinlock resource leak in probe function
[ Upstream commit 002679f ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 60d1c1d commit 6b860ae

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/pinctrl/stm32/pinctrl-stm32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1537,7 +1537,7 @@ int stm32_pctl_probe(struct platform_device *pdev)
15371537
if (hwlock_id == -EPROBE_DEFER)
15381538
return hwlock_id;
15391539
} else {
1540-
pctl->hwlock = hwspin_lock_request_specific(hwlock_id);
1540+
pctl->hwlock = devm_hwspin_lock_request_specific(dev, hwlock_id);
15411541
}
15421542

15431543
spin_lock_init(&pctl->irqmux_lock);

0 commit comments

Comments
 (0)