diff mbox series

[-next] media: imx-jpeg: Fix error return code in mxc_jpeg_probe()

Message ID 20210323112855.1016779-1-weiyongjun1@huawei.com (mailing list archive)
State New, archived
Headers show
Series [-next] media: imx-jpeg: Fix error return code in mxc_jpeg_probe() | expand

Commit Message

Wei Yongjun March 23, 2021, 11:28 a.m. UTC
From: Wei Yongjun <weiyongjun1@huawei.com>

Fix to return negative error code from the error handling
case instead of 0, as done elsewhere in this function.

Fixes: 2db16c6ed72c ("media: imx-jpeg: Add V4L2 driver for i.MX8 JPEG Encoder/Decoder")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/media/platform/imx-jpeg/mxc-jpeg.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Mirela Rabulea March 27, 2021, 2:36 p.m. UTC | #1
Hi,

On Tue, 2021-03-23 at 11:28 +0000, 'w00385741 wrote:
> From: Wei Yongjun <weiyongjun1@huawei.com>
> 
> Fix to return negative error code from the error handling
> case instead of 0, as done elsewhere in this function.
> 
> Fixes: 2db16c6ed72c ("media: imx-jpeg: Add V4L2 driver for i.MX8 JPEG
> Encoder/Decoder")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>  drivers/media/platform/imx-jpeg/mxc-jpeg.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/media/platform/imx-jpeg/mxc-jpeg.c
> b/drivers/media/platform/imx-jpeg/mxc-jpeg.c
> index 2d29558f1864..70b9b61fbf88 100644
> --- a/drivers/media/platform/imx-jpeg/mxc-jpeg.c
> +++ b/drivers/media/platform/imx-jpeg/mxc-jpeg.c
> @@ -2022,12 +2022,14 @@ static int mxc_jpeg_probe(struct
> platform_device *pdev)
>  	jpeg->m2m_dev = v4l2_m2m_init(&mxc_jpeg_m2m_ops);
>  	if (IS_ERR(jpeg->m2m_dev)) {
>  		dev_err(dev, "failed to register v4l2 device\n");
> +		ret = PTR_ERR(jpeg->m2m_dev);
>  		goto err_m2m;
>  	}
>  
>  	jpeg->dec_vdev = video_device_alloc();
>  	if (!jpeg->dec_vdev) {
>  		dev_err(dev, "failed to register v4l2 device\n");
> +		ret = -ENOMEM;
>  		goto err_vdev_alloc;
>  	}
>  	if (mode == MXC_JPEG_ENCODE)
> 
Thanks for the patch.

Reviewed-by: Mirela Rabulea <mirela.rabulea@nxp.com>

Regards,
Mirela
diff mbox series

Patch

diff --git a/drivers/media/platform/imx-jpeg/mxc-jpeg.c b/drivers/media/platform/imx-jpeg/mxc-jpeg.c
index 2d29558f1864..70b9b61fbf88 100644
--- a/drivers/media/platform/imx-jpeg/mxc-jpeg.c
+++ b/drivers/media/platform/imx-jpeg/mxc-jpeg.c
@@ -2022,12 +2022,14 @@  static int mxc_jpeg_probe(struct platform_device *pdev)
 	jpeg->m2m_dev = v4l2_m2m_init(&mxc_jpeg_m2m_ops);
 	if (IS_ERR(jpeg->m2m_dev)) {
 		dev_err(dev, "failed to register v4l2 device\n");
+		ret = PTR_ERR(jpeg->m2m_dev);
 		goto err_m2m;
 	}
 
 	jpeg->dec_vdev = video_device_alloc();
 	if (!jpeg->dec_vdev) {
 		dev_err(dev, "failed to register v4l2 device\n");
+		ret = -ENOMEM;
 		goto err_vdev_alloc;
 	}
 	if (mode == MXC_JPEG_ENCODE)