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 4.19 216/264] media: platform: s3c-camif: Fix runtime PM imbalance on error
    Date
    From: Dinghao Liu <dinghao.liu@zju.edu.cn>

    [ Upstream commit dafa3605fe60d5a61239d670919b2a36e712481e ]

    pm_runtime_get_sync() increments the runtime PM usage counter even
    when it returns an error code. Thus a pairing decrement is needed on
    the error handling path to keep the counter balanced.

    Also, call pm_runtime_disable() when pm_runtime_get_sync() returns
    an error code.

    Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
    Reviewed-by: Sylwester Nawrocki <snawrocki@kernel.org>
    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/s3c-camif/camif-core.c | 5 ++---
    1 file changed, 2 insertions(+), 3 deletions(-)

    diff --git a/drivers/media/platform/s3c-camif/camif-core.c b/drivers/media/platform/s3c-camif/camif-core.c
    index 79bc0ef6bb413..8d8ed72bd0aaf 100644
    --- a/drivers/media/platform/s3c-camif/camif-core.c
    +++ b/drivers/media/platform/s3c-camif/camif-core.c
    @@ -476,7 +476,7 @@ static int s3c_camif_probe(struct platform_device *pdev)

    ret = camif_media_dev_init(camif);
    if (ret < 0)
    - goto err_alloc;
    + goto err_pm;

    ret = camif_register_sensor(camif);
    if (ret < 0)
    @@ -510,10 +510,9 @@ static int s3c_camif_probe(struct platform_device *pdev)
    media_device_unregister(&camif->media_dev);
    media_device_cleanup(&camif->media_dev);
    camif_unregister_media_entities(camif);
    -err_alloc:
    +err_pm:
    pm_runtime_put(dev);
    pm_runtime_disable(dev);
    -err_pm:
    camif_clk_put(camif);
    err_clk:
    s3c_camif_unregister_subdev(camif);
    --
    2.25.1


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