lkml.org 
[lkml]   [2020]   [Oct]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.8 537/633] media: exynos4-is: Fix several reference count leaks due to pm_runtime_get_sync
    Date
    From: Qiushi Wu <wu000273@umn.edu>

    [ 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 | 4 +++-
    drivers/media/platform/exynos4-is/fimc-lite.c | 2 +-
    2 files changed, 4 insertions(+), 2 deletions(-)

    diff --git a/drivers/media/platform/exynos4-is/fimc-isp.c b/drivers/media/platform/exynos4-is/fimc-isp.c
    index cde0d254ec1c4..a77c49b185115 100644
    --- a/drivers/media/platform/exynos4-is/fimc-isp.c
    +++ b/drivers/media/platform/exynos4-is/fimc-isp.c
    @@ -305,8 +305,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);
    diff --git a/drivers/media/platform/exynos4-is/fimc-lite.c b/drivers/media/platform/exynos4-is/fimc-lite.c
    index 394e0818f2d5c..92130d7791378 100644
    --- a/drivers/media/platform/exynos4-is/fimc-lite.c
    +++ b/drivers/media/platform/exynos4-is/fimc-lite.c
    @@ -470,7 +470,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)
    --
    2.25.1


    \
     
     \ /
      Last update: 2020-10-27 17:54    [W:4.042 / U:0.036 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site