media: exynos4-is: Fix several reference count leaks due to pm_runtime_get_sync
[ Upstream commit 7ef64ceea0
]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
62f3bc0700
commit
8babe11e46
@ -305,8 +305,10 @@ static int fimc_isp_subdev_s_power(struct v4l2_subdev *sd, int on)
|
|||||||
|
|
||||||
if (on) {
|
if (on) {
|
||||||
ret = pm_runtime_get_sync(&is->pdev->dev);
|
ret = pm_runtime_get_sync(&is->pdev->dev);
|
||||||
if (ret < 0)
|
if (ret < 0) {
|
||||||
|
pm_runtime_put(&is->pdev->dev);
|
||||||
return ret;
|
return ret;
|
||||||
|
}
|
||||||
set_bit(IS_ST_PWR_ON, &is->state);
|
set_bit(IS_ST_PWR_ON, &is->state);
|
||||||
|
|
||||||
ret = fimc_is_start_firmware(is);
|
ret = fimc_is_start_firmware(is);
|
||||||
|
@ -470,7 +470,7 @@ static int fimc_lite_open(struct file *file)
|
|||||||
set_bit(ST_FLITE_IN_USE, &fimc->state);
|
set_bit(ST_FLITE_IN_USE, &fimc->state);
|
||||||
ret = pm_runtime_get_sync(&fimc->pdev->dev);
|
ret = pm_runtime_get_sync(&fimc->pdev->dev);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto unlock;
|
goto err_pm;
|
||||||
|
|
||||||
ret = v4l2_fh_open(file);
|
ret = v4l2_fh_open(file);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
Reference in New Issue
Block a user