Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

soc: qcom: smem: fix hwspinlock resource leak in probe error paths

The hwspinlock acquired via hwspin_lock_request_specific() is not
released on several error paths. This results in resource leakage
when probe fails.

Switch to devm_hwspin_lock_request_specific() to automatically
handle cleanup on probe failure. Remove the manual hwspin_lock_free()
in qcom_smem_remove() as devm handles it automatically.

Fixes: 20bb6c9de1b7 ("soc: qcom: smem: map only partitions used by local HOST")
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20251029022733.255-1-vulab@iscas.ac.cn
Signed-off-by: Bjorn Andersson <andersson@kernel.org>

authored by

Haotian Zhang and committed by
Bjorn Andersson
dc5db350 df8764c2

+1 -2
+1 -2
drivers/soc/qcom/smem.c
··· 1190 1190 return dev_err_probe(&pdev->dev, hwlock_id, 1191 1191 "failed to retrieve hwlock\n"); 1192 1192 1193 - smem->hwlock = hwspin_lock_request_specific(hwlock_id); 1193 + smem->hwlock = devm_hwspin_lock_request_specific(&pdev->dev, hwlock_id); 1194 1194 if (!smem->hwlock) 1195 1195 return -ENXIO; 1196 1196 ··· 1243 1243 { 1244 1244 platform_device_unregister(__smem->socinfo); 1245 1245 1246 - hwspin_lock_free(__smem->hwlock); 1247 1246 __smem = NULL; 1248 1247 } 1249 1248