diff mbox series

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

Message ID 20190424181543.GA31200@embeddedor (mailing list archive)
State Accepted, archived
Delegated to: Andy Shevchenko
Headers show
Series platform/x86: thinkpad_acpi: Mark expected switch fall-throughs | expand

Commit Message

Gustavo A. R. Silva April 24, 2019, 6:15 p.m. UTC
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.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 drivers/platform/x86/thinkpad_acpi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Kees Cook April 24, 2019, 7:05 p.m. UTC | #1
On Wed, Apr 24, 2019 at 11:15 AM 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 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.
>
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>

Reviewed-by: Kees Cook <keescook@chromium.org>

-Kees

> ---
>  drivers/platform/x86/thinkpad_acpi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
> index 57d9ae9d8e56..826e9a276818 100644
> --- a/drivers/platform/x86/thinkpad_acpi.c
> +++ b/drivers/platform/x86/thinkpad_acpi.c
> @@ -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
>
ibm-acpi@hmh.eng.br April 25, 2019, 12:55 a.m. UTC | #2
On Wed, Apr 24, 2019, at 16:05, Kees Cook wrote:
> On Wed, Apr 24, 2019 at 11:15 AM 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 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.
> >
> > Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> 
> Reviewed-by: Kees Cook <keescook@chromium.org>

Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Gustavo A. R. Silva May 1, 2019, 8:43 p.m. UTC | #3
On 4/24/19 7:55 PM, ibm-acpi@hmh.eng.br wrote:
> On Wed, Apr 24, 2019, at 16:05, Kees Cook wrote:
>> On Wed, Apr 24, 2019 at 11:15 AM 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 warnings:
>>>

[..]

>>>
>>> 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 <gustavo@embeddedor.com>
>>
>> Reviewed-by: Kees Cook <keescook@chromium.org>
> 
> Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
> 

Thank you both, Kees and Henrique.

Friendly ping:

Who can take this?

Thanks
--
Gustavo
Andy Shevchenko May 6, 2019, 12:22 p.m. UTC | #4
On Wed, May 1, 2019 at 11:44 PM Gustavo A. R. Silva
<gustavo@embeddedor.com> wrote:
>
>
>
> On 4/24/19 7:55 PM, ibm-acpi@hmh.eng.br wrote:
> > On Wed, Apr 24, 2019, at 16:05, Kees Cook wrote:
> >> On Wed, Apr 24, 2019 at 11:15 AM 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 warnings:
> >>>
>
> [..]
>
> >>>
> >>> 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 <gustavo@embeddedor.com>
> >>
> >> Reviewed-by: Kees Cook <keescook@chromium.org>
> >
> > Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
> >
>
> Thank you both, Kees and Henrique.
>
> Friendly ping:
>
> Who can take this?

Pushed to my review and testing queue, thanks!

>
> Thanks
> --
> Gustavo



--
With Best Regards,
Andy Shevchenko
diff mbox series

Patch

diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 57d9ae9d8e56..826e9a276818 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -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))