diff mbox series

[2/7] media: platform: add missing put_device() call in mtk_jpeg_probe()

Message ID 20201009123804.3977562-3-yukuai3@huawei.com (mailing list archive)
State New, archived
Headers show
Series patches to add missing put_device() call | expand

Commit Message

Yu Kuai Oct. 9, 2020, 12:37 p.m. UTC
if mtk_jpeg_clk_init() succeed, mtk_jpeg_probe() doesn't have a
corresponding put_device(). Thus add put_device() in jump target to fix
the exception handling for this function implementation.

Fixes: b2f0d2724ba4 ("[media] vcodec: mediatek: Add Mediatek JPEG Decoder Driver")
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
 drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Hans Verkuil Oct. 30, 2020, 9:46 a.m. UTC | #1
On 09/10/2020 14:37, Yu Kuai wrote:
> if mtk_jpeg_clk_init() succeed, mtk_jpeg_probe() doesn't have a
> corresponding put_device(). Thus add put_device() in jump target to fix
> the exception handling for this function implementation.
> 
> Fixes: b2f0d2724ba4 ("[media] vcodec: mediatek: Add Mediatek JPEG Decoder Driver")
> Signed-off-by: Yu Kuai <yukuai3@huawei.com>
> ---
>  drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
> index 106543391c46..f0c412f96d61 100644
> --- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
> +++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
> @@ -1436,6 +1436,7 @@ static int mtk_jpeg_probe(struct platform_device *pdev)
>  	v4l2_device_unregister(&jpeg->v4l2_dev);
>  
>  err_dev_register:
> +	put_device(jpeg->larb);
>  
>  err_clk_init:
>  
> 

This is too confusing since it is not obvious that this is the
counterpart of mtk_jpeg_clk_init. I think it would be much easier
to understand if you add a mtk_jpeg_clk_release() which does this
put_device, and call that new function both here and in mtk_jpeg_remove().

Regards,

	Hans
diff mbox series

Patch

diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
index 106543391c46..f0c412f96d61 100644
--- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
+++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
@@ -1436,6 +1436,7 @@  static int mtk_jpeg_probe(struct platform_device *pdev)
 	v4l2_device_unregister(&jpeg->v4l2_dev);
 
 err_dev_register:
+	put_device(jpeg->larb);
 
 err_clk_init: