linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio: chemical: sps30: mark expected switch fall-throughs
@ 2019-02-13  2:48 Gustavo A. R. Silva
  2019-02-13 19:11 ` Tomasz Duszynski
  0 siblings, 1 reply; 2+ messages in thread
From: Gustavo A. R. Silva @ 2019-02-13  2:48 UTC (permalink / raw)
  To: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler
  Cc: linux-iio, linux-kernel, Gustavo A. R. Silva, Kees Cook

In preparation to enabling -Wimplicit-fallthrough, mark switch
cases where we are expecting to fall through.

This patch fixes the following warnings:

drivers/iio/chemical/sps30.c: In function ‘sps30_read_raw’:
drivers/iio/chemical/sps30.c:289:4: warning: this statement may fall through [-Wimplicit-fallthrough=]
    switch (chan->channel2) {
    ^~~~~~
drivers/iio/chemical/sps30.c:299:3: note: here
   default:
   ^~~~~~~
drivers/iio/chemical/sps30.c: In function ‘sps30_do_cmd’:
drivers/iio/chemical/sps30.c:120:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
   buf[1] = (u8)SPS30_AUTO_CLEANING_PERIOD;
          ^
drivers/iio/chemical/sps30.c:121:2: note: here
  case SPS30_READ_DATA_READY_FLAG:
  ^~~~
drivers/gpio/gpio-eic-sprd.c: In function ‘sprd_eic_irq_set_type’:
drivers/gpio/gpio-eic-sprd.c:403:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
   switch (flow_type) {
   ^~~~~~
drivers/gpio/gpio-eic-sprd.c:435:2: note: here
  default:
  ^~~~~~~

Warning level 3 was used: -Wimplicit-fallthrough=3

This patch is part of the ongoing efforts to enable
-Wimplicit-fallthrough.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 drivers/iio/chemical/sps30.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/iio/chemical/sps30.c b/drivers/iio/chemical/sps30.c
index e03a28a67146..f308d8ddceec 100644
--- a/drivers/iio/chemical/sps30.c
+++ b/drivers/iio/chemical/sps30.c
@@ -118,6 +118,7 @@ static int sps30_do_cmd(struct sps30_state *state, u16 cmd, u8 *data, int size)
 	case SPS30_READ_AUTO_CLEANING_PERIOD:
 		buf[0] = SPS30_AUTO_CLEANING_PERIOD >> 8;
 		buf[1] = (u8)SPS30_AUTO_CLEANING_PERIOD;
+		/* fall through */
 	case SPS30_READ_DATA_READY_FLAG:
 	case SPS30_READ_DATA:
 	case SPS30_READ_SERIAL:
@@ -296,6 +297,7 @@ static int sps30_read_raw(struct iio_dev *indio_dev,
 
 				return IIO_VAL_INT_PLUS_MICRO;
 			}
+			/* fall through */
 		default:
 			return -EINVAL;
 		}
-- 
2.20.1


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

* Re: [PATCH] iio: chemical: sps30: mark expected switch fall-throughs
  2019-02-13  2:48 [PATCH] iio: chemical: sps30: mark expected switch fall-throughs Gustavo A. R. Silva
@ 2019-02-13 19:11 ` Tomasz Duszynski
  0 siblings, 0 replies; 2+ messages in thread
From: Tomasz Duszynski @ 2019-02-13 19:11 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, linux-iio, linux-kernel, Kees Cook

On Tue, Feb 12, 2019 at 08:48:42PM -0600, Gustavo A. R. Silva wrote:
> In preparation to enabling -Wimplicit-fallthrough, mark switch
> cases where we are expecting to fall through.
>
> This patch fixes the following warnings:
>

That have been already fixed by this commit available at Greg's staging tree:

59b9bb0 iio:chemical:sps30 Suppress some switch fallthrough warnings.


> drivers/iio/chemical/sps30.c: In function ‘sps30_read_raw’:
> drivers/iio/chemical/sps30.c:289:4: warning: this statement may fall through [-Wimplicit-fallthrough=]
>     switch (chan->channel2) {
>     ^~~~~~
> drivers/iio/chemical/sps30.c:299:3: note: here
>    default:
>    ^~~~~~~
> drivers/iio/chemical/sps30.c: In function ‘sps30_do_cmd’:
> drivers/iio/chemical/sps30.c:120:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
>    buf[1] = (u8)SPS30_AUTO_CLEANING_PERIOD;
>           ^
> drivers/iio/chemical/sps30.c:121:2: note: here
>   case SPS30_READ_DATA_READY_FLAG:
>   ^~~~
> drivers/gpio/gpio-eic-sprd.c: In function ‘sprd_eic_irq_set_type’:
> drivers/gpio/gpio-eic-sprd.c:403:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
>    switch (flow_type) {
>    ^~~~~~
> drivers/gpio/gpio-eic-sprd.c:435:2: note: here
>   default:
>   ^~~~~~~
>
> Warning level 3 was used: -Wimplicit-fallthrough=3
>
> This patch is part of the ongoing efforts to enable
> -Wimplicit-fallthrough.
>
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> ---
>  drivers/iio/chemical/sps30.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/iio/chemical/sps30.c b/drivers/iio/chemical/sps30.c
> index e03a28a67146..f308d8ddceec 100644
> --- a/drivers/iio/chemical/sps30.c
> +++ b/drivers/iio/chemical/sps30.c
> @@ -118,6 +118,7 @@ static int sps30_do_cmd(struct sps30_state *state, u16 cmd, u8 *data, int size)
>  	case SPS30_READ_AUTO_CLEANING_PERIOD:
>  		buf[0] = SPS30_AUTO_CLEANING_PERIOD >> 8;
>  		buf[1] = (u8)SPS30_AUTO_CLEANING_PERIOD;
> +		/* fall through */
>  	case SPS30_READ_DATA_READY_FLAG:
>  	case SPS30_READ_DATA:
>  	case SPS30_READ_SERIAL:
> @@ -296,6 +297,7 @@ static int sps30_read_raw(struct iio_dev *indio_dev,
>
>  				return IIO_VAL_INT_PLUS_MICRO;
>  			}
> +			/* fall through */
>  		default:
>  			return -EINVAL;
>  		}
> --
> 2.20.1
>

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

end of thread, other threads:[~2019-02-13 19:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-13  2:48 [PATCH] iio: chemical: sps30: mark expected switch fall-throughs Gustavo A. R. Silva
2019-02-13 19:11 ` Tomasz Duszynski

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).