diff mbox series

[02/13] media: i2c: imx214: Remove unneeded goto

Message ID 20240902-imx214-v1-2-c96cba989315@apitzsch.eu
State New
Headers show
Series media: i2c: imx214: Miscellaneous cleanups and improvements | expand

Commit Message

André Apitzsch via B4 Relay Sept. 2, 2024, 9:54 p.m. UTC
From: André Apitzsch <git@apitzsch.eu>

Simplify the imx214_start_streaming() by removing unneeded goto
statements, and the corresponding error label.

Signed-off-by: André Apitzsch <git@apitzsch.eu>
---
 drivers/media/i2c/imx214.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

Comments

Ricardo Ribalda Delgado Sept. 12, 2024, 1:40 p.m. UTC | #1
Hi  Andre

On Mon, Sep 2, 2024 at 11:53 PM André Apitzsch via B4 Relay
<devnull+git.apitzsch.eu@kernel.org> wrote:
>
> From: André Apitzsch <git@apitzsch.eu>
>
> Simplify the imx214_start_streaming() by removing unneeded goto
> statements, and the corresponding error label.

Could you squash this patch with the previous one?

Thanks!


>
> Signed-off-by: André Apitzsch <git@apitzsch.eu>
> ---
>  drivers/media/i2c/imx214.c | 13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/media/i2c/imx214.c b/drivers/media/i2c/imx214.c
> index 58f3c3f67e0d..283d4783c22e 100644
> --- a/drivers/media/i2c/imx214.c
> +++ b/drivers/media/i2c/imx214.c
> @@ -776,7 +776,7 @@ static int imx214_start_streaming(struct imx214 *imx214)
>         ret = imx214_write_table(imx214, mode_table_common);
>         if (ret < 0) {
>                 dev_err(imx214->dev, "could not sent common table %d\n", ret);
> -               goto error;
> +               return ret;
>         }
>
>         mode = v4l2_find_nearest_size(imx214_modes,
> @@ -785,22 +785,17 @@ static int imx214_start_streaming(struct imx214 *imx214)
>         ret = imx214_write_table(imx214, mode->reg_table);
>         if (ret < 0) {
>                 dev_err(imx214->dev, "could not sent mode table %d\n", ret);
> -               goto error;
> +               return ret;
>         }
>         ret = __v4l2_ctrl_handler_setup(&imx214->ctrls);
>         if (ret < 0) {
>                 dev_err(imx214->dev, "could not sync v4l2 controls\n");
> -               goto error;
> +               return ret;
>         }
>         ret = regmap_write(imx214->regmap, IMX214_REG_MODE_SELECT, IMX214_MODE_STREAMING);
> -       if (ret < 0) {
> +       if (ret < 0)
>                 dev_err(imx214->dev, "could not sent start table %d\n", ret);
> -               goto error;
> -       }
> -
> -       return 0;
>
> -error:
>         return ret;
>  }
>
>
> --
> 2.46.0
>
>
diff mbox series

Patch

diff --git a/drivers/media/i2c/imx214.c b/drivers/media/i2c/imx214.c
index 58f3c3f67e0d..283d4783c22e 100644
--- a/drivers/media/i2c/imx214.c
+++ b/drivers/media/i2c/imx214.c
@@ -776,7 +776,7 @@  static int imx214_start_streaming(struct imx214 *imx214)
 	ret = imx214_write_table(imx214, mode_table_common);
 	if (ret < 0) {
 		dev_err(imx214->dev, "could not sent common table %d\n", ret);
-		goto error;
+		return ret;
 	}
 
 	mode = v4l2_find_nearest_size(imx214_modes,
@@ -785,22 +785,17 @@  static int imx214_start_streaming(struct imx214 *imx214)
 	ret = imx214_write_table(imx214, mode->reg_table);
 	if (ret < 0) {
 		dev_err(imx214->dev, "could not sent mode table %d\n", ret);
-		goto error;
+		return ret;
 	}
 	ret = __v4l2_ctrl_handler_setup(&imx214->ctrls);
 	if (ret < 0) {
 		dev_err(imx214->dev, "could not sync v4l2 controls\n");
-		goto error;
+		return ret;
 	}
 	ret = regmap_write(imx214->regmap, IMX214_REG_MODE_SELECT, IMX214_MODE_STREAMING);
-	if (ret < 0) {
+	if (ret < 0)
 		dev_err(imx214->dev, "could not sent start table %d\n", ret);
-		goto error;
-	}
-
-	return 0;
 
-error:
 	return ret;
 }