diff mbox series

[v4,4/8] media: i2c: ov2659: fix s_stream return value

Message ID 20190927184722.31989-5-bparrot@ti.com (mailing list archive)
State New, archived
Headers show
Series media: i2c: ov2659: maintenance series | expand

Commit Message

Benoit Parrot Sept. 27, 2019, 6:47 p.m. UTC
In ov2659_s_stream() return value for invoked function should be checked
and propagated.

Signed-off-by: Benoit Parrot <bparrot@ti.com>
---
 drivers/media/i2c/ov2659.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Comments

Lad, Prabhakar Sept. 27, 2019, 8:33 p.m. UTC | #1
Hi Benoit,

thank you for the patch.

On Fri, Sep 27, 2019 at 7:46 PM Benoit Parrot <bparrot@ti.com> wrote:
>
> In ov2659_s_stream() return value for invoked function should be checked
> and propagated.
>
> Signed-off-by: Benoit Parrot <bparrot@ti.com>
> ---
>  drivers/media/i2c/ov2659.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/media/i2c/ov2659.c b/drivers/media/i2c/ov2659.c
> index f77320e8a60d..cd4625432264 100644
> --- a/drivers/media/i2c/ov2659.c
> +++ b/drivers/media/i2c/ov2659.c
> @@ -1187,10 +1187,13 @@ static int ov2659_s_stream(struct v4l2_subdev *sd, int on)
>                 goto unlock;
>         }
>
> -       ov2659_set_pixel_clock(ov2659);
> -       ov2659_set_frame_size(ov2659);
> -       ov2659_set_format(ov2659);
> -       ov2659_set_streaming(ov2659, 1);
> +       ret = ov2659_set_pixel_clock(ov2659);
> +       if (!ret)
> +               ret = ov2659_set_frame_size(ov2659);
> +       if (!ret)
> +               ret = ov2659_set_format(ov2659);
> +       if (!ret)
> +               ov2659_set_streaming(ov2659, 1);
>         ov2659->streaming = on;
>
the "ov2659->streaming = on;" should only be set if above calls
succeed, otherwise we might hit -EBUSY during set_fmt.

Cheers,
--Prabhakar Lad

>  unlock:
> --
> 2.17.1
>
Benoit Parrot Sept. 30, 2019, 12:08 p.m. UTC | #2
Lad, Prabhakar <prabhakar.csengg@gmail.com> wrote on Fri [2019-Sep-27 21:33:28 +0100]:
> Hi Benoit,
> 
> thank you for the patch.
> 
> On Fri, Sep 27, 2019 at 7:46 PM Benoit Parrot <bparrot@ti.com> wrote:
> >
> > In ov2659_s_stream() return value for invoked function should be checked
> > and propagated.
> >
> > Signed-off-by: Benoit Parrot <bparrot@ti.com>
> > ---
> >  drivers/media/i2c/ov2659.c | 11 +++++++----
> >  1 file changed, 7 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/media/i2c/ov2659.c b/drivers/media/i2c/ov2659.c
> > index f77320e8a60d..cd4625432264 100644
> > --- a/drivers/media/i2c/ov2659.c
> > +++ b/drivers/media/i2c/ov2659.c
> > @@ -1187,10 +1187,13 @@ static int ov2659_s_stream(struct v4l2_subdev *sd, int on)
> >                 goto unlock;
> >         }
> >
> > -       ov2659_set_pixel_clock(ov2659);
> > -       ov2659_set_frame_size(ov2659);
> > -       ov2659_set_format(ov2659);
> > -       ov2659_set_streaming(ov2659, 1);
> > +       ret = ov2659_set_pixel_clock(ov2659);
> > +       if (!ret)
> > +               ret = ov2659_set_frame_size(ov2659);
> > +       if (!ret)
> > +               ret = ov2659_set_format(ov2659);
> > +       if (!ret)
> > +               ov2659_set_streaming(ov2659, 1);
> >         ov2659->streaming = on;
> >
> the "ov2659->streaming = on;" should only be set if above calls
> succeed, otherwise we might hit -EBUSY during set_fmt.

Thanks, good catch.

Benoit

> 
> Cheers,
> --Prabhakar Lad
> 
> >  unlock:
> > --
> > 2.17.1
> >
diff mbox series

Patch

diff --git a/drivers/media/i2c/ov2659.c b/drivers/media/i2c/ov2659.c
index f77320e8a60d..cd4625432264 100644
--- a/drivers/media/i2c/ov2659.c
+++ b/drivers/media/i2c/ov2659.c
@@ -1187,10 +1187,13 @@  static int ov2659_s_stream(struct v4l2_subdev *sd, int on)
 		goto unlock;
 	}
 
-	ov2659_set_pixel_clock(ov2659);
-	ov2659_set_frame_size(ov2659);
-	ov2659_set_format(ov2659);
-	ov2659_set_streaming(ov2659, 1);
+	ret = ov2659_set_pixel_clock(ov2659);
+	if (!ret)
+		ret = ov2659_set_frame_size(ov2659);
+	if (!ret)
+		ret = ov2659_set_format(ov2659);
+	if (!ret)
+		ov2659_set_streaming(ov2659, 1);
 	ov2659->streaming = on;
 
 unlock: