diff mbox series

[09/17] media: nxp: imx-jpeg: replace dummy gotos by returns

Message ID 20230126150657.367921-10-hverkuil-cisco@xs4all.nl (mailing list archive)
State New, archived
Headers show
Series media: sparse/smatch fixes | expand

Commit Message

Hans Verkuil Jan. 26, 2023, 3:06 p.m. UTC
The err_irq and err_clk labels just did a 'return ret'. So
drop these and replace them by just a return.

This fixes a smatch warning:

mxc-jpeg.c:2492 mxc_jpeg_probe() warn: missing unwind goto?

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: Mirela Rabulea <mirela.rabulea@nxp.com>
---
 .../media/platform/nxp/imx-jpeg/mxc-jpeg.c    | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

Comments

Mirela Rabulea Jan. 27, 2023, 8:38 p.m. UTC | #1
On 26.01.2023 17:06, Hans Verkuil wrote:
> 
> The err_irq and err_clk labels just did a 'return ret'. So
> drop these and replace them by just a return.
> 
> This fixes a smatch warning:
> 
> mxc-jpeg.c:2492 mxc_jpeg_probe() warn: missing unwind goto?
> 
> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>

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

> Cc: Mirela Rabulea <mirela.rabulea@nxp.com>
> ---
>   .../media/platform/nxp/imx-jpeg/mxc-jpeg.c    | 19 ++++++-------------
>   1 file changed, 6 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c
> index 6cd015a35f7c..552d0900cb26 100644
> --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c
> +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c
> @@ -2445,7 +2445,7 @@ static int mxc_jpeg_probe(struct platform_device *pdev)
>          ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32));
>          if (ret) {
>                  dev_err(&pdev->dev, "No suitable DMA available.\n");
> -               goto err_irq;
> +               return ret;
>          }
> 
>          jpeg->base_reg = devm_platform_ioremap_resource(pdev, 0);
> @@ -2454,16 +2454,14 @@ static int mxc_jpeg_probe(struct platform_device *pdev)
> 
>          for (slot = 0; slot < MXC_MAX_SLOTS; slot++) {
>                  dec_irq = platform_get_irq(pdev, slot);
> -               if (dec_irq < 0) {
> -                       ret = dec_irq;
> -                       goto err_irq;
> -               }
> +               if (dec_irq < 0)
> +                       return dec_irq;
>                  ret = devm_request_irq(&pdev->dev, dec_irq, mxc_jpeg_dec_irq,
>                                         0, pdev->name, jpeg);
>                  if (ret) {
>                          dev_err(&pdev->dev, "Failed to request irq %d (%d)\n",
>                                  dec_irq, ret);
> -                       goto err_irq;
> +                       return ret;
>                  }
>          }
> 
> @@ -2475,15 +2473,13 @@ static int mxc_jpeg_probe(struct platform_device *pdev)
>          jpeg->clk_ipg = devm_clk_get(dev, "ipg");
>          if (IS_ERR(jpeg->clk_ipg)) {
>                  dev_err(dev, "failed to get clock: ipg\n");
> -               ret = PTR_ERR(jpeg->clk_ipg);
> -               goto err_clk;
> +               return PTR_ERR(jpeg->clk_ipg);
>          }
> 
>          jpeg->clk_per = devm_clk_get(dev, "per");
>          if (IS_ERR(jpeg->clk_per)) {
>                  dev_err(dev, "failed to get clock: per\n");
> -               ret = PTR_ERR(jpeg->clk_per);
> -               goto err_clk;
> +               return PTR_ERR(jpeg->clk_per);
>          }
> 
>          ret = mxc_jpeg_attach_pm_domains(jpeg);
> @@ -2569,9 +2565,6 @@ static int mxc_jpeg_probe(struct platform_device *pdev)
> 
>   err_register:
>          mxc_jpeg_detach_pm_domains(jpeg);
> -
> -err_irq:
> -err_clk:
>          return ret;
>   }
> 
> --
> 2.39.0
>
diff mbox series

Patch

diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c
index 6cd015a35f7c..552d0900cb26 100644
--- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c
+++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c
@@ -2445,7 +2445,7 @@  static int mxc_jpeg_probe(struct platform_device *pdev)
 	ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32));
 	if (ret) {
 		dev_err(&pdev->dev, "No suitable DMA available.\n");
-		goto err_irq;
+		return ret;
 	}
 
 	jpeg->base_reg = devm_platform_ioremap_resource(pdev, 0);
@@ -2454,16 +2454,14 @@  static int mxc_jpeg_probe(struct platform_device *pdev)
 
 	for (slot = 0; slot < MXC_MAX_SLOTS; slot++) {
 		dec_irq = platform_get_irq(pdev, slot);
-		if (dec_irq < 0) {
-			ret = dec_irq;
-			goto err_irq;
-		}
+		if (dec_irq < 0)
+			return dec_irq;
 		ret = devm_request_irq(&pdev->dev, dec_irq, mxc_jpeg_dec_irq,
 				       0, pdev->name, jpeg);
 		if (ret) {
 			dev_err(&pdev->dev, "Failed to request irq %d (%d)\n",
 				dec_irq, ret);
-			goto err_irq;
+			return ret;
 		}
 	}
 
@@ -2475,15 +2473,13 @@  static int mxc_jpeg_probe(struct platform_device *pdev)
 	jpeg->clk_ipg = devm_clk_get(dev, "ipg");
 	if (IS_ERR(jpeg->clk_ipg)) {
 		dev_err(dev, "failed to get clock: ipg\n");
-		ret = PTR_ERR(jpeg->clk_ipg);
-		goto err_clk;
+		return PTR_ERR(jpeg->clk_ipg);
 	}
 
 	jpeg->clk_per = devm_clk_get(dev, "per");
 	if (IS_ERR(jpeg->clk_per)) {
 		dev_err(dev, "failed to get clock: per\n");
-		ret = PTR_ERR(jpeg->clk_per);
-		goto err_clk;
+		return PTR_ERR(jpeg->clk_per);
 	}
 
 	ret = mxc_jpeg_attach_pm_domains(jpeg);
@@ -2569,9 +2565,6 @@  static int mxc_jpeg_probe(struct platform_device *pdev)
 
 err_register:
 	mxc_jpeg_detach_pm_domains(jpeg);
-
-err_irq:
-err_clk:
 	return ret;
 }