media: exynos4-is: Fix a reference count leak due to pm_runtime_get_sync
authorQiushi Wu <wu000273@umn.edu>
Sun, 14 Jun 2020 03:10:58 +0000 (05:10 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sun, 27 Sep 2020 08:55:09 +0000 (10:55 +0200)
On calling pm_runtime_get_sync() the reference count of the device
is incremented. In case of failure, decrement the
reference count before returning the error.

Signed-off-by: Qiushi Wu <wu000273@umn.edu>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/platform/exynos4-is/media-dev.c

index 7d92793a8e74af75b9f0c8170bbb63699dc9ce87..e636c33e847bd6cb0832e25075285f2302e9df71 100644 (file)
@@ -509,8 +509,10 @@ static int fimc_md_register_sensor_entities(struct fimc_md *fmd)
                return -ENXIO;
 
        ret = pm_runtime_get_sync(fmd->pmf);
-       if (ret < 0)
+       if (ret < 0) {
+               pm_runtime_put(fmd->pmf);
                return ret;
+       }
 
        fmd->num_sensors = 0;