Skip to contentSkip to conversation

linux-next: build failure after merge of the drivers-x86 tree

DISCUSSION Stephen Rothwell 3 participants 3 messages Aug 20, 2021 Linux-next tree

lore
Share & tools
lore
#0 lore raw

Hi all,

After merging the drivers-x86 tree, today's linux-next build (x86_64 allmodconfig) failed like this:

drivers/platform/x86/ideapad-laptop.c: In function 'ideapad_wmi_notify':
drivers/platform/x86/ideapad-laptop.c:1469:3: error: a label can only be part of a statement and a declaration is not a statement

 1469 |   unsigned long result;
      |   ^~~~~~~~

Caused by commit

18cfd76e7b84 ("ideapad-laptop: Fix Legion 5 Fn lock LED")

I have used the drivers-x86 tree from next-20210819 for today.

Signature · 2 lines
Cheers,
Stephen Rothwell
#1 lore raw
Quoted 13 lines · Stephen Rothwell

Hi all,

After merging the drivers-x86 tree, today's linux-next build (x86_64 allmodconfig) failed like this:

drivers/platform/x86/ideapad-laptop.c: In function 'ideapad_wmi_notify':
drivers/platform/x86/ideapad-laptop.c:1469:3: error: a label can only be part of a statement and a declaration is not a statement

 1469 |   unsigned long result;
      |   ^~~~~~~~

Caused by commit

Quoted 7 lines

18cfd76e7b84 ("ideapad-laptop: Fix Legion 5 Fn lock LED")

I have used the drivers-x86 tree from next-20210819 for today.

--
Cheers,
Stephen Rothwell

Hi Stephen,

Thanks for your work!

This error occurs because only a statement is allowed after a label, but a definition is not a statement in C99.
This can be fixed by wrapping the case block with curly braces like this:
case 208: {
...
}

However I don't know why my compiler did not report this error. I was using gcc 11.1.0 under Arch Linux.

Regards,
Meng Dong

#2 lore raw

Hi,

Quoted 24 lines · M D
Quoted 13 lines · Stephen Rothwell

Hi all,

After merging the drivers-x86 tree, today's linux-next build (x86_64 allmodconfig) failed like this:

drivers/platform/x86/ideapad-laptop.c: In function 'ideapad_wmi_notify':
drivers/platform/x86/ideapad-laptop.c:1469:3: error: a label can only be part of a statement and a declaration is not a statement

 1469 |   unsigned long result;
      |   ^~~~~~~~

Caused by commit

Quoted 7 lines

18cfd76e7b84 ("ideapad-laptop: Fix Legion 5 Fn lock LED")

I have used the drivers-x86 tree from next-20210819 for today.

--
Cheers,
Stephen Rothwell

Hi Stephen,

Quoted 8 lines

Thanks for your work!

This error occurs because only a statement is allowed after a label, but a definition is not a statement in C99.
This can be fixed by wrapping the case block with curly braces like this:
case 208: {
...
}

Yes, or just move the declaration of result to the beginning of the function, which is a bit cleaner IMHO.

I've moved the declaration to the beginning of the function and squashed this fix into the original commit. I'll do a forced push with the squashed in fix to for-next as soon as a test-compile completes.

Stephen, as always thank you your work on linux-next and for reporting this.

Quoted 2 lines

However I don't know why my compiler did not report this error. I was using gcc 11.1.0 under Arch Linux.

Yes gcc 11.2.1 under Fedora also happily compiles this, and this sat in my review-hans branch for a while and got happily compiled by "kernel test robot <[email protected]> " there too.

So this compile error slipped through the crack of all our (compile) testing until Stephen caught it :)

Regards,

Hans