Commit 3bd4edd6 authored by Haotian Zhang's avatar Haotian Zhang Committed by Kevin Hilman
Browse files

hwspinlock: omap: Handle devm_pm_runtime_enable() errors



Although unlikely, devm_pm_runtime_enable() can fail due to memory
allocations. Without proper error handling, the subsequent
pm_runtime_resume_and_get() call may operate on incorrectly
initialized runtime PM state.

Add error handling to check the return value of
devm_pm_runtime_enable() and return on failure.

Fixes: 25f7d74d ("hwspinlock: omap: Use devm_pm_runtime_enable() helper")
Signed-off-by: default avatarHaotian Zhang <vulab@iscas.ac.cn>
Link: https://patch.msgid.link/20251124104805.135-1-vulab@iscas.ac.cn


Signed-off-by: default avatarKevin Hilman <khilman@baylibre.com>
parent 5e2d6fa4
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -88,7 +88,9 @@ static int omap_hwspinlock_probe(struct platform_device *pdev)
	 * make sure the module is enabled and clocked before reading
	 * the module SYSSTATUS register
	 */
	devm_pm_runtime_enable(&pdev->dev);
	ret = devm_pm_runtime_enable(&pdev->dev);
	if (ret)
		return ret;
	ret = pm_runtime_resume_and_get(&pdev->dev);
	if (ret < 0)
		return ret;