platform/x86: thinkpad_acpi: Mark expected switch fall-throughs
PATCH 1/1 platform/x86: thinkpad_acpi: Mark expected switch fall-throughs
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.
This patch fixes the following warnings:
drivers/platform/x86/thinkpad_acpi.c: In function ‘thermal_get_sensor’:drivers/platform/x86/thinkpad_acpi.c:6316:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
if (idx >= 8 && idx <= 15) {
^drivers/platform/x86/thinkpad_acpi.c:6322:2: note: here
case TPACPI_THERMAL_TPEC_8:
^~~~drivers/platform/x86/thinkpad_acpi.c: In function ‘hotkey_notify’:drivers/platform/x86/thinkpad_acpi.c:4208:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
if (tp_features.hotkey_wlsw &&
^drivers/platform/x86/thinkpad_acpi.c:4216:3: note: here
default:
^~~~~~~
Warning level 3 was used: -Wimplicit-fallthrough=3
Notice that, in this particular case, the code comments are modified in accordance with what GCC is expecting to find.
This patch is part of the ongoing efforts to enable -Wimplicit-fallthrough.
--- drivers/platform/x86/thinkpad_acpi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/thinkpad_acpi.c +2 -2
@@ -4212,7 +4212,7 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event) known_ev = true;break ; } -/* fallthrough to default */ +/* fallthrough - to default */ default : known_ev = false; }
@@ -6317,8 +6317,8 @@ static int thermal_get_sensor(int idx, s32 *value) t =TP_EC_THERMAL_TMP8 ; idx -= 8; } -/* fallthrough */ #endif +/* fallthrough */ case TPACPI_THERMAL_TPEC_8 :if (idx <=7 ) {if (!acpi_ec_read (t + idx, &tmp))
Signature · 1 line
2.21.0
Quoted 23 lines · 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 warnings:
drivers/platform/x86/thinkpad_acpi.c: In function ‘thermal_get_sensor’:drivers/platform/x86/thinkpad_acpi.c:6316:6: warning: this statement may fall through [-Wimplicit-fallthrough=]if (idx >= 8 && idx <= 15) { ^
drivers/platform/x86/thinkpad_acpi.c:6322:2: note: here
caseTPACPI_THERMAL_TPEC_8:
^~~~drivers/platform/x86/thinkpad_acpi.c: In function ‘hotkey_notify’:drivers/platform/x86/thinkpad_acpi.c:4208:7: warning: this statement may fall through [-Wimplicit-fallthrough=]if (tp_features.hotkey_wlsw && ^ drivers/platform/x86/thinkpad_acpi.c:4216:3: note: here default: ^~~~~~~Warning level 3 was used: -Wimplicit-fallthrough=3
Quoted 7 lines
Notice that, in this particular case, the code comments are 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]>
-Kees
Quoted 30 lines
--- drivers/platform/x86/thinkpad_acpi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/platform/x86/thinkpad_acpi.c +2
-3@@ -4212,7 +4212,7 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event) known_ev = true;break ; } -/* fallthrough to default */ +/* fallthrough - to default */ default : known_ev = false; }@@ -6317,8 +6317,8 @@ static int thermal_get_sensor(int idx, s32 *value) t =TP_EC_THERMAL_TMP8 ; idx -= 8; } -/* fallthrough */ #endif +/* fallthrough */ case TPACPI_THERMAL_TPEC_8 :if (idx <=7 ) {if (!acpi_ec_read (t + idx, &tmp)) --2.21.0
Signature · 1 line
Kees Cook
[email protected]
Acked-by Henrique de Moraes HolschuhQuoted 28 lines · Kees Cook
Quoted 26 lines · 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 warnings:
drivers/platform/x86/thinkpad_acpi.c: In function ‘thermal_get_sensor’:drivers/platform/x86/thinkpad_acpi.c:6316:6: warning: this statement may fall through [-Wimplicit-fallthrough=]if (idx >= 8 && idx <= 15) { ^
drivers/platform/x86/thinkpad_acpi.c:6322:2: note: here
caseTPACPI_THERMAL_TPEC_8:
^~~~drivers/platform/x86/thinkpad_acpi.c: In function ‘hotkey_notify’:drivers/platform/x86/thinkpad_acpi.c:4208:7: warning: this statement may fall through [-Wimplicit-fallthrough=]if (tp_features.hotkey_wlsw && ^ drivers/platform/x86/thinkpad_acpi.c:4216:3: note: here default: ^~~~~~~Warning level 3 was used: -Wimplicit-fallthrough=3
Notice that, in this particular case, the code comments are modified in accordance with what GCC is expecting to find.
Quoted 6 lines
Quoted 4 lines
This patch is part of the ongoing efforts to enable -Wimplicit-fallthrough.
Signed-off-by Gustavo A. R. Silva <[email protected]>Reviewed-by Kees Cook <[email protected]>
Quoted 9 lines · On 4/24/19 7:55 PM, [email protected] wrote:
Quoted 8 lines · Kees Cook
Quoted 6 lines · 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 warnings:
[..]
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Warning level 3 was used: -Wimplicit-fallthrough=3
Notice that, in this particular case, the code comments are modified in accordance with what GCC is expecting to find.
Quoted 9 lines
Quoted 6 lines
Quoted 4 lines
This patch is part of the ongoing efforts to enable -Wimplicit-fallthrough.
Signed-off-by Gustavo A. R. Silva <[email protected]>Reviewed-by Kees Cook <[email protected]>
Thank you both, Kees and Henrique.
Friendly ping:
Who can take this?
Thanks
--
Gustavo
Quoted 29 lines · Gustavo A. R. Silva
Quoted 9 lines · On 4/24/19 7:55 PM, [email protected] wrote:
Quoted 8 lines · Kees Cook
Quoted 6 lines · 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 warnings:
[..]
Quoted 13 lines
Quoted 12 lines
Quoted 10 lines
Warning level 3 was used: -Wimplicit-fallthrough=3
Notice that, in this particular case, the code comments are 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]>Reviewed-by Kees Cook <[email protected]>
Quoted 8 lines
Quoted 2 lines
Thank you both, Kees and Henrique.
Friendly ping:
Who can take this?
Pushed to my review and testing queue, thanks!
Quoted 4 lines
Thanks
--
Gustavo
--
With Best Regards,
Andy Shevchenko