linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio: mma8452: mark expected switch fall-through
@ 2019-02-11 22:23 Gustavo A. R. Silva
  2019-02-20 12:17 ` Jonathan Cameron
  0 siblings, 1 reply; 8+ messages in thread
From: Gustavo A. R. Silva @ 2019-02-11 22:23 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 warning:

drivers/iio/accel/mma8452.c: In function ‘mma8452_probe’:
drivers/iio/accel/mma8452.c:1581:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
   if (ret == data->chip_info->chip_id)
      ^
drivers/iio/accel/mma8452.c:1584:2: note: here
  default:
  ^~~~~~~

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

Notice that, in this particular case, the code comment is modified
in accordance with what GCC is expecting to find.

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

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

diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
index 302781126bc6..00e100fc845a 100644
--- a/drivers/iio/accel/mma8452.c
+++ b/drivers/iio/accel/mma8452.c
@@ -1580,7 +1580,7 @@ static int mma8452_probe(struct i2c_client *client,
 	case FXLS8471_DEVICE_ID:
 		if (ret == data->chip_info->chip_id)
 			break;
-		/* else: fall through */
+		/* fall through */
 	default:
 		ret = -ENODEV;
 		goto disable_regulators;
-- 
2.20.1


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

* Re: [PATCH] iio: mma8452: mark expected switch fall-through
  2019-02-11 22:23 [PATCH] iio: mma8452: mark expected switch fall-through Gustavo A. R. Silva
@ 2019-02-20 12:17 ` Jonathan Cameron
  2019-02-20 17:21   ` Gustavo A. R. Silva
  0 siblings, 1 reply; 8+ messages in thread
From: Jonathan Cameron @ 2019-02-20 12:17 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	linux-iio, linux-kernel, Kees Cook

On Mon, 11 Feb 2019 16:23:18 -0600
"Gustavo A. R. Silva" <gustavo@embeddedor.com> wrote:

> In preparation to enabling -Wimplicit-fallthrough, mark switch
> cases where we are expecting to fall through.
> 
> This patch fixes the following warning:
> 
> drivers/iio/accel/mma8452.c: In function ‘mma8452_probe’:
> drivers/iio/accel/mma8452.c:1581:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
>    if (ret == data->chip_info->chip_id)
>       ^
> drivers/iio/accel/mma8452.c:1584:2: note: here
>   default:
>   ^~~~~~~
> 
> Warning level 3 was used: -Wimplicit-fallthrough=3
> 
> Notice that, in this particular case, the code comment is modified
> in accordance with what GCC is expecting to find.
> 
> This patch is part of the ongoing efforts to enable
> -Wimplicit-fallthrough.
> 
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
I know Peter probably won't like this, as it doesn't
read a as well, with the else dropped, but I'm going to take
it as we have had a lot of bugs caught by this code and this
is generating a false positive.

Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to play with it.

Thanks,

Jonathan

> ---
>  drivers/iio/accel/mma8452.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
> index 302781126bc6..00e100fc845a 100644
> --- a/drivers/iio/accel/mma8452.c
> +++ b/drivers/iio/accel/mma8452.c
> @@ -1580,7 +1580,7 @@ static int mma8452_probe(struct i2c_client *client,
>  	case FXLS8471_DEVICE_ID:
>  		if (ret == data->chip_info->chip_id)
>  			break;
> -		/* else: fall through */
> +		/* fall through */
>  	default:
>  		ret = -ENODEV;
>  		goto disable_regulators;


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

* Re: [PATCH] iio: mma8452: mark expected switch fall-through
  2019-02-20 12:17 ` Jonathan Cameron
@ 2019-02-20 17:21   ` Gustavo A. R. Silva
  2019-02-20 18:07     ` Gustavo A. R. Silva
  0 siblings, 1 reply; 8+ messages in thread
From: Gustavo A. R. Silva @ 2019-02-20 17:21 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	linux-iio, linux-kernel, Kees Cook



On 2/20/19 6:17 AM, Jonathan Cameron wrote:
> On Mon, 11 Feb 2019 16:23:18 -0600
> "Gustavo A. R. Silva" <gustavo@embeddedor.com> wrote:
> 
>> In preparation to enabling -Wimplicit-fallthrough, mark switch
>> cases where we are expecting to fall through.
>>
>> This patch fixes the following warning:
>>
>> drivers/iio/accel/mma8452.c: In function ‘mma8452_probe’:
>> drivers/iio/accel/mma8452.c:1581:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
>>    if (ret == data->chip_info->chip_id)
>>       ^
>> drivers/iio/accel/mma8452.c:1584:2: note: here
>>   default:
>>   ^~~~~~~
>>
>> Warning level 3 was used: -Wimplicit-fallthrough=3
>>
>> Notice that, in this particular case, the code comment is modified
>> in accordance with what GCC is expecting to find.
>>
>> This patch is part of the ongoing efforts to enable
>> -Wimplicit-fallthrough.
>>
>> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> I know Peter probably won't like this, as it doesn't
> read a as well, with the else dropped, but I'm going to take
> it as we have had a lot of bugs caught by this code and this
> is generating a false positive.
> 
> Applied to the togreg branch of iio.git and pushed out as testing
> for the autobuilders to play with it.
> 

Thanks, Jonathan.

--
Gustavo


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

* Re: [PATCH] iio: mma8452: mark expected switch fall-through
  2019-02-20 17:21   ` Gustavo A. R. Silva
@ 2019-02-20 18:07     ` Gustavo A. R. Silva
  2019-03-03 17:04       ` Jonathan Cameron
  0 siblings, 1 reply; 8+ messages in thread
From: Gustavo A. R. Silva @ 2019-02-20 18:07 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	linux-iio, linux-kernel, Kees Cook



On 2/20/19 11:21 AM, Gustavo A. R. Silva wrote:
> 
> 
> On 2/20/19 6:17 AM, Jonathan Cameron wrote:
>> On Mon, 11 Feb 2019 16:23:18 -0600
>> "Gustavo A. R. Silva" <gustavo@embeddedor.com> wrote:
>>
>>> In preparation to enabling -Wimplicit-fallthrough, mark switch
>>> cases where we are expecting to fall through.
>>>
>>> This patch fixes the following warning:
>>>
>>> drivers/iio/accel/mma8452.c: In function ‘mma8452_probe’:
>>> drivers/iio/accel/mma8452.c:1581:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
>>>    if (ret == data->chip_info->chip_id)
>>>       ^
>>> drivers/iio/accel/mma8452.c:1584:2: note: here
>>>   default:
>>>   ^~~~~~~
>>>
>>> Warning level 3 was used: -Wimplicit-fallthrough=3
>>>
>>> Notice that, in this particular case, the code comment is modified
>>> in accordance with what GCC is expecting to find.
>>>
>>> This patch is part of the ongoing efforts to enable
>>> -Wimplicit-fallthrough.
>>>
>>> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
>> I know Peter probably won't like this, as it doesn't
>> read a as well, with the else dropped, but I'm going to take
>> it as we have had a lot of bugs caught by this code and this
>> is generating a false positive.
>>
>> Applied to the togreg branch of iio.git and pushed out as testing
>> for the autobuilders to play with it.
>>
> 
> Thanks, Jonathan.
> 

BTW, Jonathan, I wonder if you can apply this one too:

https://lore.kernel.org/patchwork/patch/996804/

Thanks
--
Gustavo

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

* Re: [PATCH] iio: mma8452: mark expected switch fall-through
  2019-02-20 18:07     ` Gustavo A. R. Silva
@ 2019-03-03 17:04       ` Jonathan Cameron
  2019-03-03 17:35         ` Gustavo A. R. Silva
  0 siblings, 1 reply; 8+ messages in thread
From: Jonathan Cameron @ 2019-03-03 17:04 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	linux-iio, linux-kernel, Kees Cook

On Wed, 20 Feb 2019 12:07:28 -0600
"Gustavo A. R. Silva" <gustavo@embeddedor.com> wrote:

> On 2/20/19 11:21 AM, Gustavo A. R. Silva wrote:
> > 
> > 
> > On 2/20/19 6:17 AM, Jonathan Cameron wrote:  
> >> On Mon, 11 Feb 2019 16:23:18 -0600
> >> "Gustavo A. R. Silva" <gustavo@embeddedor.com> wrote:
> >>  
> >>> In preparation to enabling -Wimplicit-fallthrough, mark switch
> >>> cases where we are expecting to fall through.
> >>>
> >>> This patch fixes the following warning:
> >>>
> >>> drivers/iio/accel/mma8452.c: In function ‘mma8452_probe’:
> >>> drivers/iio/accel/mma8452.c:1581:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
> >>>    if (ret == data->chip_info->chip_id)
> >>>       ^
> >>> drivers/iio/accel/mma8452.c:1584:2: note: here
> >>>   default:
> >>>   ^~~~~~~
> >>>
> >>> Warning level 3 was used: -Wimplicit-fallthrough=3
> >>>
> >>> Notice that, in this particular case, the code comment is modified
> >>> in accordance with what GCC is expecting to find.
> >>>
> >>> This patch is part of the ongoing efforts to enable
> >>> -Wimplicit-fallthrough.
> >>>
> >>> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>  
> >> I know Peter probably won't like this, as it doesn't
> >> read a as well, with the else dropped, but I'm going to take
> >> it as we have had a lot of bugs caught by this code and this
> >> is generating a false positive.
> >>
> >> Applied to the togreg branch of iio.git and pushed out as testing
> >> for the autobuilders to play with it.
> >>  
> > 
> > Thanks, Jonathan.
> >   
> 
> BTW, Jonathan, I wonder if you can apply this one too:
> 
> https://lore.kernel.org/patchwork/patch/996804/
> 
> Thanks
Now resolved.  The issue here was the code was 'interesting/crazy' so
we needed someone with hardware to rewrite it and test the result.

Simply fixing the fall through wasn't enough :(

Jonathan

> --
> Gustavo


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

* Re: [PATCH] iio: mma8452: mark expected switch fall-through
  2019-03-03 17:04       ` Jonathan Cameron
@ 2019-03-03 17:35         ` Gustavo A. R. Silva
  0 siblings, 0 replies; 8+ messages in thread
From: Gustavo A. R. Silva @ 2019-03-03 17:35 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	linux-iio, linux-kernel, Kees Cook



On 3/3/19 11:04 AM, Jonathan Cameron wrote:

>>
>> BTW, Jonathan, I wonder if you can apply this one too:
>>
>> https://lore.kernel.org/patchwork/patch/996804/
>>
>> Thanks
> Now resolved.  The issue here was the code was 'interesting/crazy' so
> we needed someone with hardware to rewrite it and test the result.
> 

Yep.

> Simply fixing the fall through wasn't enough :(
> 

I'm happy this was finally resolved. :)

Thanks, Jonathan.

--
Gustavo

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

* Re: [PATCH] iio: mma8452: Mark expected switch fall-through
  2018-07-03 19:44 [PATCH] iio: mma8452: Mark " Gustavo A. R. Silva
@ 2018-07-07 17:04 ` Jonathan Cameron
  0 siblings, 0 replies; 8+ messages in thread
From: Jonathan Cameron @ 2018-07-07 17:04 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	linux-iio, linux-kernel

On Tue, 3 Jul 2018 14:44:36 -0500
"Gustavo A. R. Silva" <gustavo@embeddedor.com> wrote:

> In preparation to enabling -Wimplicit-fallthrough, mark switch cases
> where we are expecting to fall through.
> 
> Warning level 2 was used in this case: -Wimplicit-fallthrough=2
> 
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>

Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to ignore.

Thanks,

Jonathan

> ---
>  drivers/iio/accel/mma8452.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
> index c149c9c..421a0a8 100644
> --- a/drivers/iio/accel/mma8452.c
> +++ b/drivers/iio/accel/mma8452.c
> @@ -1547,6 +1547,7 @@ static int mma8452_probe(struct i2c_client *client,
>  	case FXLS8471_DEVICE_ID:
>  		if (ret == data->chip_info->chip_id)
>  			break;
> +		/* else: fall through */
>  	default:
>  		return -ENODEV;
>  	}


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

* [PATCH] iio: mma8452: Mark expected switch fall-through
@ 2018-07-03 19:44 Gustavo A. R. Silva
  2018-07-07 17:04 ` Jonathan Cameron
  0 siblings, 1 reply; 8+ messages in thread
From: Gustavo A. R. Silva @ 2018-07-03 19:44 UTC (permalink / raw)
  To: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler
  Cc: linux-iio, linux-kernel, Gustavo A. R. Silva

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

Warning level 2 was used in this case: -Wimplicit-fallthrough=2

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

diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
index c149c9c..421a0a8 100644
--- a/drivers/iio/accel/mma8452.c
+++ b/drivers/iio/accel/mma8452.c
@@ -1547,6 +1547,7 @@ static int mma8452_probe(struct i2c_client *client,
 	case FXLS8471_DEVICE_ID:
 		if (ret == data->chip_info->chip_id)
 			break;
+		/* else: fall through */
 	default:
 		return -ENODEV;
 	}
-- 
2.7.4


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

end of thread, other threads:[~2019-03-03 17:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-11 22:23 [PATCH] iio: mma8452: mark expected switch fall-through Gustavo A. R. Silva
2019-02-20 12:17 ` Jonathan Cameron
2019-02-20 17:21   ` Gustavo A. R. Silva
2019-02-20 18:07     ` Gustavo A. R. Silva
2019-03-03 17:04       ` Jonathan Cameron
2019-03-03 17:35         ` Gustavo A. R. Silva
  -- strict thread matches above, loose matches on Subject: below --
2018-07-03 19:44 [PATCH] iio: mma8452: Mark " Gustavo A. R. Silva
2018-07-07 17:04 ` 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).