]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
accel/ivpu: Ensure rpm_runtime_put in case of engine reset/resume fail
authorKarol Wachowski <karol.wachowski@linux.intel.com>
Tue, 16 Sep 2025 08:48:09 +0000 (10:48 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Dec 2025 13:02:25 +0000 (14:02 +0100)
[ Upstream commit 9f6c63285737b141ca25a619add80a96111b8b96 ]

Previously, aborting work could return early after engine reset or resume
failure, skipping the necessary runtime_put cleanup leaving the device
with incorrect reference count breaking runtime power management state.

Replace early returns with goto statements to ensure runtime_put is always
executed.

Fixes: a47e36dc5d90 ("accel/ivpu: Trigger device recovery on engine reset/resume failure")
Reviewed-by: Lizhi Hou <lizhi.hou@amd.com>
Signed-off-by: Karol Wachowski <karol.wachowski@linux.intel.com>
Link: https://lore.kernel.org/r/20250916084809.850073-1-karol.wachowski@linux.intel.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/accel/ivpu/ivpu_job.c

index 060f1fc031d347e6d047800f409d1b84453172f1..dbefa43c74e287e2af316f168c453c7efa3b704a 100644 (file)
@@ -1012,7 +1012,7 @@ void ivpu_context_abort_work_fn(struct work_struct *work)
 
        if (vdev->fw->sched_mode == VPU_SCHEDULING_MODE_HW)
                if (ivpu_jsm_reset_engine(vdev, 0))
-                       return;
+                       goto runtime_put;
 
        mutex_lock(&vdev->context_list_lock);
        xa_for_each(&vdev->context_xa, ctx_id, file_priv) {
@@ -1036,7 +1036,7 @@ void ivpu_context_abort_work_fn(struct work_struct *work)
                goto runtime_put;
 
        if (ivpu_jsm_hws_resume_engine(vdev, 0))
-               return;
+               goto runtime_put;
        /*
         * In hardware scheduling mode NPU already has stopped processing jobs
         * and won't send us any further notifications, thus we have to free job related resources