Skip to contentSkip to conversation

platform/x86: thinkpad_acpi: Mark expected switch fall-throughs

PATCH In review Gustavo A. R. Silva 4 participants 5 messages Apr 24, 2019 – May 6, 2019 x86 platform drivers

lore
Share & tools
lore
#0 lore raw

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
index 57d9ae9d8e56..826e9a276818 100644
@@ -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
Reviewed-by on v1 1/1
#1 lore raw
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
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

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.

-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
index 57d9ae9d8e56..826e9a276818 100644
@@ -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
Acked-by Henrique de Moraes Holschuh
#2 lore raw
Quoted 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
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.

Quoted 6 lines
Quoted 4 lines

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

#3 lore raw
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.

Thank you both, Kees and Henrique.

Friendly ping:

Who can take this?

Thanks
--
Gustavo

#4 lore raw
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.

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