summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Kuai <yukuai3@huawei.com>2020-11-04 15:41:36 +0300
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2020-11-16 12:31:16 +0300
commit0d72f489995bb8565f6fe30539d4504c88356a9e (patch)
tree3ee7cc5a36d97f9589a89ac3fd010704ad44ba78
parentf50613c1a83070a5212bbf394559ebd4b09e3f20 (diff)
downloadlinux-0d72f489995bb8565f6fe30539d4504c88356a9e.tar.xz
media: platform: add missing put_device() call in mtk_jpeg_probe() and mtk_jpeg_remove()
if mtk_jpeg_clk_init() succeed, mtk_jpeg_probe() and mtk_jpeg_remove() doesn't have a corresponding put_device(). Thus add a new helper mtk_jpeg_clk_release() to fix it. Fixes: b2f0d2724ba4 ("[media] vcodec: mediatek: Add Mediatek JPEG Decoder Driver") Signed-off-by: Yu Kuai <yukuai3@huawei.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
-rw-r--r--drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
index 106543391c46..88a23bce569d 100644
--- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
+++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
@@ -1332,6 +1332,12 @@ static void mtk_jpeg_job_timeout_work(struct work_struct *work)
v4l2_m2m_buf_done(dst_buf, VB2_BUF_STATE_ERROR);
v4l2_m2m_job_finish(jpeg->m2m_dev, ctx->fh.m2m_ctx);
}
+
+static inline void mtk_jpeg_clk_release(struct mtk_jpeg_dev *jpeg)
+{
+ put_device(jpeg->larb);
+}
+
static int mtk_jpeg_probe(struct platform_device *pdev)
{
struct mtk_jpeg_dev *jpeg;
@@ -1436,6 +1442,7 @@ err_m2m_init:
v4l2_device_unregister(&jpeg->v4l2_dev);
err_dev_register:
+ mtk_jpeg_clk_release(jpeg);
err_clk_init:
@@ -1453,6 +1460,7 @@ static int mtk_jpeg_remove(struct platform_device *pdev)
video_device_release(jpeg->vdev);
v4l2_m2m_release(jpeg->m2m_dev);
v4l2_device_unregister(&jpeg->v4l2_dev);
+ mtk_jpeg_clk_release(jpeg);
return 0;
}