OSDN Git Service

media: fimc-capture: Fix runtime PM imbalance on error
authorDinghao Liu <dinghao.liu@zju.edu.cn>
Thu, 21 May 2020 10:22:04 +0000 (12:22 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 23 Jun 2020 11:18:44 +0000 (13:18 +0200)
pm_runtime_get_sync() increments the runtime PM usage counter even
when it returns an error code. Thus a pairing decrement is needed on
the error handling path to keep the counter balanced.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/platform/exynos4-is/fimc-capture.c

index 705f182..dd33b88 100644 (file)
@@ -478,8 +478,10 @@ static int fimc_capture_open(struct file *file)
 
        set_bit(ST_CAPT_BUSY, &fimc->state);
        ret = pm_runtime_get_sync(&fimc->pdev->dev);
-       if (ret < 0)
+       if (ret < 0) {
+               pm_runtime_put_sync(&fimc->pdev->dev);
                goto unlock;
+       }
 
        ret = v4l2_fh_open(file);
        if (ret) {