Skip to content

Commit 60d1c1d

Browse files
ISCAS-Vulabgregkh
authored andcommitted
soc: qcom: smem: fix hwspinlock resource leak in probe error paths
[ Upstream commit dc5db35 ] 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: 20bb6c9 ("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 5bfe033 commit 60d1c1d

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/soc/qcom/smem.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,7 +1186,7 @@ static int qcom_smem_probe(struct platform_device *pdev)
11861186
return hwlock_id;
11871187
}
11881188

1189-
smem->hwlock = hwspin_lock_request_specific(hwlock_id);
1189+
smem->hwlock = devm_hwspin_lock_request_specific(&pdev->dev, hwlock_id);
11901190
if (!smem->hwlock)
11911191
return -ENXIO;
11921192

@@ -1239,7 +1239,6 @@ static void qcom_smem_remove(struct platform_device *pdev)
12391239
{
12401240
platform_device_unregister(__smem->socinfo);
12411241

1242-
hwspin_lock_free(__smem->hwlock);
12431242
__smem = NULL;
12441243
}
12451244

0 commit comments

Comments
 (0)