From c35fb8e694cf182ffe6edd6f0e4785d630dd7509 Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Mon, 14 Apr 2025 15:01:20 +0200 Subject: [PATCH] drm/panthor: Fix the panthor_gpu_coherency_init() error path The panthor_gpu_coherency_init() call has been moved around, but the error path hasn't been adjusted accordingly. Make sure we undo what has been done before this call in case of failure. Fixes: 7d5a3b22f5b5 ("drm/panthor: Call panthor_gpu_coherency_init() after PM resume()") Reported-by: Dan Carpenter Closes: https://lore.kernel.org/dri-devel/4da470aa-4f84-460e-aff8-dabc8cc4da15@stanley.mountain/T/#t Reviewed-by: Steven Price Reviewed-by: Liviu Dudau Link: https://lore.kernel.org/r/20250414130120.581274-1-boris.brezillon@collabora.com Signed-off-by: Boris Brezillon --- drivers/gpu/drm/panthor/panthor_device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/panthor/panthor_device.c b/drivers/gpu/drm/panthor/panthor_device.c index fd74adb4df32..d9b165438307 100644 --- a/drivers/gpu/drm/panthor/panthor_device.c +++ b/drivers/gpu/drm/panthor/panthor_device.c @@ -241,7 +241,7 @@ int panthor_device_init(struct panthor_device *ptdev) ret = pm_runtime_resume_and_get(ptdev->base.dev); if (ret) - goto err_unplug_gpu; + return ret; /* If PM is disabled, we need to call panthor_device_resume() manually. */ if (!IS_ENABLED(CONFIG_PM)) { @@ -256,7 +256,7 @@ int panthor_device_init(struct panthor_device *ptdev) ret = panthor_gpu_coherency_init(ptdev); if (ret) - return ret; + goto err_unplug_gpu; ret = panthor_mmu_init(ptdev); if (ret)