staging: media: imx: remove unnecessary return variable

Message ID Y7QVN0XY+ld2mBk4@qemulion
State New
Headers
Series staging: media: imx: remove unnecessary return variable |

Commit Message

Deepak R Varma Jan. 3, 2023, 11:44 a.m. UTC
  The function imx_media_fim_set_stream() can directly return 0 instead of
using a ret variable which never changes its value. Issue identified
using the returnvar.cocci Coccinelle semantic patch.

Signed-off-by: Deepak R Varma <drv@mailo.com>
---
 drivers/staging/media/imx/imx-media-fim.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--
2.34.1
  

Comments

Fabio Estevam Jan. 3, 2023, 11:50 a.m. UTC | #1
On Tue, Jan 3, 2023 at 8:45 AM Deepak R Varma <drv@mailo.com> wrote:
>
> The function imx_media_fim_set_stream() can directly return 0 instead of
> using a ret variable which never changes its value. Issue identified
> using the returnvar.cocci Coccinelle semantic patch.
>
> Signed-off-by: Deepak R Varma <drv@mailo.com>
> ---
>  drivers/staging/media/imx/imx-media-fim.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/staging/media/imx/imx-media-fim.c b/drivers/staging/media/imx/imx-media-fim.c
> index fb6590dcfc36..e719227d4323 100644
> --- a/drivers/staging/media/imx/imx-media-fim.c
> +++ b/drivers/staging/media/imx/imx-media-fim.c
> @@ -373,7 +373,6 @@ int imx_media_fim_set_stream(struct imx_media_fim *fim,
>                              bool on)
>  {
>         unsigned long flags;
> -       int ret = 0;
>
>         v4l2_ctrl_lock(fim->ctrl[FIM_CL_ENABLE]);
>
> @@ -393,7 +392,7 @@ int imx_media_fim_set_stream(struct imx_media_fim *fim,
>         fim->stream_on = on;
>  out:
>         v4l2_ctrl_unlock(fim->ctrl[FIM_CL_ENABLE]);
> -       return ret;
> +       return 0;

Maybe you could change imx_media_fim_set_stream() to a void function instead?
  

Patch

diff --git a/drivers/staging/media/imx/imx-media-fim.c b/drivers/staging/media/imx/imx-media-fim.c
index fb6590dcfc36..e719227d4323 100644
--- a/drivers/staging/media/imx/imx-media-fim.c
+++ b/drivers/staging/media/imx/imx-media-fim.c
@@ -373,7 +373,6 @@  int imx_media_fim_set_stream(struct imx_media_fim *fim,
 			     bool on)
 {
 	unsigned long flags;
-	int ret = 0;

 	v4l2_ctrl_lock(fim->ctrl[FIM_CL_ENABLE]);

@@ -393,7 +392,7 @@  int imx_media_fim_set_stream(struct imx_media_fim *fim,
 	fim->stream_on = on;
 out:
 	v4l2_ctrl_unlock(fim->ctrl[FIM_CL_ENABLE]);
-	return ret;
+	return 0;
 }

 int imx_media_fim_add_controls(struct imx_media_fim *fim)