media: exynos4-is: Fix a reference count leak due to pm_runtime_get_sync

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>
This commit is contained in:
Qiushi Wu 2020-06-14 05:10:58 +02:00 коммит произвёл Mauro Carvalho Chehab
Родитель 64157b2cb1
Коммит c47f7c779e
1 изменённых файлов: 3 добавлений и 1 удалений

Просмотреть файл

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