Skip to content

Commit

Permalink
media: platform: add missing put_device() call in mtk_jpeg_probe() an…
Browse files Browse the repository at this point in the history
…d mtk_jpeg_remove()

[ Upstream commit 0d72f48 ]

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: b2f0d27 ("[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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Yu Kuai authored and gregkh committed Dec 30, 2020
1 parent a330750 commit 393957d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
Expand Up @@ -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;
Expand Down Expand Up @@ -1436,6 +1442,7 @@ static int mtk_jpeg_probe(struct platform_device *pdev)
v4l2_device_unregister(&jpeg->v4l2_dev);

err_dev_register:
mtk_jpeg_clk_release(jpeg);

err_clk_init:

Expand All @@ -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;
}
Expand Down

0 comments on commit 393957d

Please sign in to comment.