public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: atomisp: clean up return logic, remove redunant code
@ 2017-03-11 19:32 Colin King
  2017-03-12 14:56 ` walter harms
  0 siblings, 1 reply; 3+ messages in thread
From: Colin King @ 2017-03-11 19:32 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Greg Kroah-Hartman, Alan Cox, linux-media,
	devel
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

There is no need to check if ret is non-zero, remove this
redundant check and just return the error status from the call
to mt9m114_write_reg_array.

Detected by CoverityScan, CID#1416577 ("Identical code for
different branches")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/staging/media/atomisp/i2c/mt9m114.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/staging/media/atomisp/i2c/mt9m114.c b/drivers/staging/media/atomisp/i2c/mt9m114.c
index 8762124..a555aec 100644
--- a/drivers/staging/media/atomisp/i2c/mt9m114.c
+++ b/drivers/staging/media/atomisp/i2c/mt9m114.c
@@ -444,12 +444,8 @@ static int mt9m114_set_suspend(struct v4l2_subdev *sd)
 static int mt9m114_init_common(struct v4l2_subdev *sd)
 {
 	struct i2c_client *client = v4l2_get_subdevdata(sd);
-	int ret;
 
-	ret = mt9m114_write_reg_array(client, mt9m114_common, PRE_POLLING);
-	if (ret)
-		return ret;
-	return ret;
+	return mt9m114_write_reg_array(client, mt9m114_common, PRE_POLLING);
 }
 
 static int power_ctrl(struct v4l2_subdev *sd, bool flag)
-- 
2.10.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: atomisp: clean up return logic, remove redunant code
  2017-03-11 19:32 [PATCH] staging: atomisp: clean up return logic, remove redunant code Colin King
@ 2017-03-12 14:56 ` walter harms
  2017-03-12 15:00   ` Julia Lawall
  0 siblings, 1 reply; 3+ messages in thread
From: walter harms @ 2017-03-12 14:56 UTC (permalink / raw)
  To: Colin King
  Cc: Mauro Carvalho Chehab, Greg Kroah-Hartman, Alan Cox, linux-media,
	devel, kernel-janitors, linux-kernel



Am 11.03.2017 20:32, schrieb Colin King:
> From: Colin Ian King <colin.king@canonical.com>
> 
> There is no need to check if ret is non-zero, remove this
> redundant check and just return the error status from the call
> to mt9m114_write_reg_array.
> 
> Detected by CoverityScan, CID#1416577 ("Identical code for
> different branches")
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/staging/media/atomisp/i2c/mt9m114.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/media/atomisp/i2c/mt9m114.c b/drivers/staging/media/atomisp/i2c/mt9m114.c
> index 8762124..a555aec 100644
> --- a/drivers/staging/media/atomisp/i2c/mt9m114.c
> +++ b/drivers/staging/media/atomisp/i2c/mt9m114.c
> @@ -444,12 +444,8 @@ static int mt9m114_set_suspend(struct v4l2_subdev *sd)
>  static int mt9m114_init_common(struct v4l2_subdev *sd)
>  {
>  	struct i2c_client *client = v4l2_get_subdevdata(sd);
> -	int ret;
>  
> -	ret = mt9m114_write_reg_array(client, mt9m114_common, PRE_POLLING);
> -	if (ret)
> -		return ret;
> -	return ret;
> +	return mt9m114_write_reg_array(client, mt9m114_common, PRE_POLLING);
>  }


any use for "client" ?

re,
 wh

>  
>  static int power_ctrl(struct v4l2_subdev *sd, bool flag)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: atomisp: clean up return logic, remove redunant code
  2017-03-12 14:56 ` walter harms
@ 2017-03-12 15:00   ` Julia Lawall
  0 siblings, 0 replies; 3+ messages in thread
From: Julia Lawall @ 2017-03-12 15:00 UTC (permalink / raw)
  To: walter harms
  Cc: Colin King, Mauro Carvalho Chehab, Greg Kroah-Hartman, Alan Cox,
	linux-media, devel, kernel-janitors, linux-kernel



On Sun, 12 Mar 2017, walter harms wrote:

>
>
> Am 11.03.2017 20:32, schrieb Colin King:
> > From: Colin Ian King <colin.king@canonical.com>
> >
> > There is no need to check if ret is non-zero, remove this
> > redundant check and just return the error status from the call
> > to mt9m114_write_reg_array.
> >
> > Detected by CoverityScan, CID#1416577 ("Identical code for
> > different branches")
> >
> > Signed-off-by: Colin Ian King <colin.king@canonical.com>
> > ---
> >  drivers/staging/media/atomisp/i2c/mt9m114.c | 6 +-----
> >  1 file changed, 1 insertion(+), 5 deletions(-)
> >
> > diff --git a/drivers/staging/media/atomisp/i2c/mt9m114.c b/drivers/staging/media/atomisp/i2c/mt9m114.c
> > index 8762124..a555aec 100644
> > --- a/drivers/staging/media/atomisp/i2c/mt9m114.c
> > +++ b/drivers/staging/media/atomisp/i2c/mt9m114.c
> > @@ -444,12 +444,8 @@ static int mt9m114_set_suspend(struct v4l2_subdev *sd)
> >  static int mt9m114_init_common(struct v4l2_subdev *sd)
> >  {
> >  	struct i2c_client *client = v4l2_get_subdevdata(sd);
> > -	int ret;
> >
> > -	ret = mt9m114_write_reg_array(client, mt9m114_common, PRE_POLLING);
> > -	if (ret)
> > -		return ret;
> > -	return ret;
> > +	return mt9m114_write_reg_array(client, mt9m114_common, PRE_POLLING);
> >  }
>
>
> any use for "client" ?

I guess the code would be on two lines in any case.  It looks like a nice
decomposition as is.

julia

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-03-12 15:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-11 19:32 [PATCH] staging: atomisp: clean up return logic, remove redunant code Colin King
2017-03-12 14:56 ` walter harms
2017-03-12 15:00   ` Julia Lawall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox