From: Qiushi Wu <[email protected]>

pm_runtime_get_sync() increments the runtime PM usage counter even
when it returns an error code. Thus call pm_runtime_put_noidle()
if pm_runtime_get_sync() fails.

Fixes: 2a18fbec1dab ("media: rcar-vin: Move pm_runtime_{get,put} out of 
helpers")
Signed-off-by: Qiushi Wu <[email protected]>
---
 drivers/media/platform/rcar-vin/rcar-v4l2.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c 
b/drivers/media/platform/rcar-vin/rcar-v4l2.c
index f421e2584875..06808be35f98 100644
--- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
+++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
@@ -835,8 +835,10 @@ static int rvin_open(struct file *file)
        int ret;
 
        ret = pm_runtime_get_sync(vin->dev);
-       if (ret < 0)
+       if (ret < 0) {
+               pm_runtime_put_noidle(vin->dev);
                return ret;
+       }
 
        ret = mutex_lock_interruptible(&vin->lock);
        if (ret)
-- 
2.17.1

Reply via email to