media: amphion: Fix pm_runtime_set_suspended() with runtime pm enabled
authorJinjie Ruan <ruanjinjie@huawei.com>
Fri, 1 Nov 2024 09:40:49 +0000 (17:40 +0800)
committerHans Verkuil <hverkuil@xs4all.nl>
Thu, 7 Nov 2024 08:05:57 +0000 (09:05 +0100)
It is not valid to call pm_runtime_set_suspended() for devices
with runtime PM enabled because it returns -EAGAIN if it is enabled
already and working. So, call pm_runtime_disable() before to fix it.

Cc: stable@vger.kernel.org
Fixes: b50a64fc54af ("media: amphion: add amphion vpu device driver")
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
drivers/media/platform/amphion/vpu_drv.c

index c6cbcaf433eeafcd12e0946d21f166834fa8dcb6..efbfd2652721f010b424ca33ef1730b52f3df0bf 100644 (file)
@@ -151,8 +151,8 @@ err_add_decoder:
        media_device_cleanup(&vpu->mdev);
        v4l2_device_unregister(&vpu->v4l2_dev);
 err_vpu_deinit:
-       pm_runtime_set_suspended(dev);
        pm_runtime_disable(dev);
+       pm_runtime_set_suspended(dev);
 
        return ret;
 }