linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio: imu: inv_mpu6050: fix missing break in switch
@ 2017-08-22 19:13 Gustavo A. R. Silva
  2017-08-23  6:41 ` Peter Meerwald-Stadler
  0 siblings, 1 reply; 3+ messages in thread
From: Gustavo A. R. Silva @ 2017-08-22 19:13 UTC (permalink / raw)
  To: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler
  Cc: linux-iio, linux-kernel, Gustavo A. R. Silva

Add missing break statement to prevent the code for case
IIO_CHAN_INFO_CALIBBIAS falling through to the default case.

Also, add a break to the default case for the switch within
case IIO_CHAN_INFO_CALIBBIAS.

Addresses-Coverity-ID: 1357377
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
This issue was reported by Coverity and it was tested by compilation only.
Please, verify if this is an actual bug.

 drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
index 44830bc..6d2268a 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
@@ -542,7 +542,9 @@ static int inv_mpu6050_write_raw(struct iio_dev *indio_dev,
 			break;
 		default:
 			result = -EINVAL;
+			break;
 		}
+		break;
 	default:
 		result = -EINVAL;
 		break;
-- 
2.5.0


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

* Re: [PATCH] iio: imu: inv_mpu6050: fix missing break in switch
  2017-08-22 19:13 [PATCH] iio: imu: inv_mpu6050: fix missing break in switch Gustavo A. R. Silva
@ 2017-08-23  6:41 ` Peter Meerwald-Stadler
  2017-09-03 15:49   ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Meerwald-Stadler @ 2017-08-23  6:41 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen, linux-iio,
	linux-kernel


> Add missing break statement to prevent the code for case
> IIO_CHAN_INFO_CALIBBIAS falling through to the default case.
> 
> Also, add a break to the default case for the switch within
> case IIO_CHAN_INFO_CALIBBIAS.

fix seems to be cosmetic only...

> Addresses-Coverity-ID: 1357377
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> ---
> This issue was reported by Coverity and it was tested by compilation only.
> Please, verify if this is an actual bug.
> 
>  drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> index 44830bc..6d2268a 100644
> --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> @@ -542,7 +542,9 @@ static int inv_mpu6050_write_raw(struct iio_dev *indio_dev,
>  			break;
>  		default:
>  			result = -EINVAL;
> +			break;
>  		}
> +		break;
>  	default:
>  		result = -EINVAL;
>  		break;
> 

-- 

Peter Meerwald-Stadler
Mobile: +43 664 24 44 418

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

* Re: [PATCH] iio: imu: inv_mpu6050: fix missing break in switch
  2017-08-23  6:41 ` Peter Meerwald-Stadler
@ 2017-09-03 15:49   ` Jonathan Cameron
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2017-09-03 15:49 UTC (permalink / raw)
  To: Peter Meerwald-Stadler
  Cc: Gustavo A. R. Silva, Hartmut Knaack, Lars-Peter Clausen,
	linux-iio, linux-kernel

On Wed, 23 Aug 2017 08:41:43 +0200 (CEST)
Peter Meerwald-Stadler <pmeerw@pmeerw.net> wrote:

> > Add missing break statement to prevent the code for case
> > IIO_CHAN_INFO_CALIBBIAS falling through to the default case.
> > 
> > Also, add a break to the default case for the switch within
> > case IIO_CHAN_INFO_CALIBBIAS.  
> 
> fix seems to be cosmetic only...
> 
> > Addresses-Coverity-ID: 1357377
> > Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Indeed only cosmetic, but if it makes static analysis more productive
by removing a trivial case, it is worth having.

Applied to the togreg branch of iio.git - will be pushed out as testing
just as soon as I catch up with my backlog.

Jonathan

> > ---
> > This issue was reported by Coverity and it was tested by compilation only.
> > Please, verify if this is an actual bug.
> > 
> >  drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> > index 44830bc..6d2268a 100644
> > --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> > +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> > @@ -542,7 +542,9 @@ static int inv_mpu6050_write_raw(struct iio_dev *indio_dev,
> >  			break;
> >  		default:
> >  			result = -EINVAL;
> > +			break;
> >  		}
> > +		break;
> >  	default:
> >  		result = -EINVAL;
> >  		break;
> >   
> 


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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-22 19:13 [PATCH] iio: imu: inv_mpu6050: fix missing break in switch Gustavo A. R. Silva
2017-08-23  6:41 ` Peter Meerwald-Stadler
2017-09-03 15:49   ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).