]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
media: exynos4-is: Fix several reference count leaks due to pm_runtime_get_sync
authorQiushi Wu <wu000273@umn.edu>
Sun, 14 Jun 2020 03:18:29 +0000 (05:18 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Oct 2020 08:07:14 +0000 (09:07 +0100)
[ Upstream commit 7ef64ceea0008c17e94a8a2c60c5d6d46f481996 ]

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>
drivers/media/platform/exynos4-is/fimc-isp.c
drivers/media/platform/exynos4-is/fimc-lite.c

index fd793d3ac0725390b841dcb607009625960b5ac0..89989b2961599adad39523ae9f28098c28bf2032 100644 (file)
@@ -311,8 +311,10 @@ static int fimc_isp_subdev_s_power(struct v4l2_subdev *sd, int on)
 
        if (on) {
                ret = pm_runtime_get_sync(&is->pdev->dev);
-               if (ret < 0)
+               if (ret < 0) {
+                       pm_runtime_put(&is->pdev->dev);
                        return ret;
+               }
                set_bit(IS_ST_PWR_ON, &is->state);
 
                ret = fimc_is_start_firmware(is);
index 4a3c9948ca54761d93bc1ede4199772b8a2b3c9a..1cdca5ce4843987a4da476fb4a25a41db167b1a1 100644 (file)
@@ -480,7 +480,7 @@ static int fimc_lite_open(struct file *file)
        set_bit(ST_FLITE_IN_USE, &fimc->state);
        ret = pm_runtime_get_sync(&fimc->pdev->dev);
        if (ret < 0)
-               goto unlock;
+               goto err_pm;
 
        ret = v4l2_fh_open(file);
        if (ret < 0)