Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1598436 > unrolled thread
| Started by | Colin King <colin.king@canonical.com> |
|---|---|
| First post | 2017-03-11 20:40 +0100 |
| Last post | 2017-03-12 16:10 +0100 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH] staging: atomisp: clean up return logic, remove redunant code Colin King <colin.king@canonical.com> - 2017-03-11 20:40 +0100
Re: [PATCH] staging: atomisp: clean up return logic, remove redunant code walter harms <wharms@bfs.de> - 2017-03-12 16:00 +0100
Re: [PATCH] staging: atomisp: clean up return logic, remove redunant code Julia Lawall <julia.lawall@lip6.fr> - 2017-03-12 16:10 +0100
| From | Colin King <colin.king@canonical.com> |
|---|---|
| Date | 2017-03-11 20:40 +0100 |
| Subject | [PATCH] staging: atomisp: clean up return logic, remove redunant code |
| Message-ID | <tjV1U-7iY-3@gated-at.bofh.it> |
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
[toc] | [next] | [standalone]
| From | walter harms <wharms@bfs.de> |
|---|---|
| Date | 2017-03-12 16:00 +0100 |
| Subject | Re: [PATCH] staging: atomisp: clean up return logic, remove redunant code |
| Message-ID | <tkd8u-2UH-11@gated-at.bofh.it> |
| In reply to | #1598436 |
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)
[toc] | [prev] | [next] | [standalone]
| From | Julia Lawall <julia.lawall@lip6.fr> |
|---|---|
| Date | 2017-03-12 16:10 +0100 |
| Subject | Re: [PATCH] staging: atomisp: clean up return logic, remove redunant code |
| Message-ID | <tkdia-3e0-21@gated-at.bofh.it> |
| In reply to | #1598651 |
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
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web