media: bdisp: Fix runtime PM imbalance on error
authorDinghao Liu <dinghao.liu@zju.edu.cn>
Thu, 21 May 2020 10:00:21 +0000 (12:00 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Oct 2020 08:03:08 +0000 (09:03 +0100)
[ Upstream commit dbd2f2dc025f9be8ae063e4f270099677238f620 ]

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.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Reviewed-by: Fabien Dessenne <fabien.dessenne@st.com>
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/sti/bdisp/bdisp-v4l2.c

index a00dfaa1b945df229bc5324b8c8a1dc9d399ea68..6c97063cb3b3f1c25c5b249863d5f8fd0728d9b4 100644 (file)
@@ -1369,7 +1369,7 @@ static int bdisp_probe(struct platform_device *pdev)
        ret = pm_runtime_get_sync(dev);
        if (ret < 0) {
                dev_err(dev, "failed to set PM\n");
-               goto err_dbg;
+               goto err_pm;
        }
 
        /* Continuous memory allocator */
@@ -1406,7 +1406,6 @@ err_vb2_dma:
        vb2_dma_contig_cleanup_ctx(bdisp->alloc_ctx);
 err_pm:
        pm_runtime_put(dev);
-err_dbg:
        bdisp_debugfs_remove(bdisp);
 err_v4l2:
        v4l2_device_unregister(&bdisp->v4l2_dev);