iio: mma8452: mark expected switch fall-through
PATCH 1/1 iio: mma8452: mark expected switch fall-through
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.
--- drivers/iio/accel/mma8452.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/accel/mma8452.c +1 -1
@@ -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;
Signature · 1 line
2.20.1
Jonathan Cameron
maintainerQuoted 15 lines · On Mon, 11 Feb 2019 16:23:18 -0600 "Gustavo A. R. Silva"…
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
Quoted 7 lines
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 <[email protected]>
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
Quoted 17 lines
--- drivers/iio/accel/mma8452.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/accel/mma8452.c +1
-1@@ -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;
Quoted 24 lines · Jonathan Cameron
Quoted 21 lines · On Mon, 11 Feb 2019 16:23:18 -0600 "Gustavo A. R. Silva"…
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.
Quoted 9 lines
Quoted 1 line
Signed-off-by Gustavo A. R. Silva <[email protected]>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
Quoted 33 lines · Gustavo A. R. Silva
Quoted 30 lines · Jonathan Cameron
Quoted 15 lines · On Mon, 11 Feb 2019 16:23:18 -0600 "Gustavo A. R. Silva"…
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
Quoted 7 lines
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 <[email protected]>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.
Quoted 6 lines
Quoted 3 lines
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
Jonathan Cameron
maintainerQuoted 38 lines · On Wed, 20 Feb 2019 12:07:28 -0600 "Gustavo A. R. Silva"…
Quoted 37 lines · Gustavo A. R. Silva
Quoted 33 lines · Jonathan Cameron
Quoted 15 lines · On Mon, 11 Feb 2019 16:23:18 -0600 "Gustavo A. R. Silva"…
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
Quoted 7 lines
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 <[email protected]>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.
Quoted 8 lines
Quoted 2 lines
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
Quoted 2 lines
--
Gustavo
Quoted 9 lines · Jonathan Cameron
Quoted 6 lines
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.
Quoted 2 lines
Simply fixing the fall through wasn't enough :(
I'm happy this was finally resolved. :)
Thanks, Jonathan.
--
Gustavo