linux-next: build warning after merge of the fbdev tree
Hi Bartlomiej,
After merging the fbdev tree, today's linux-next build (x86_64 allmodconfig) produced this warning:
drivers/video/fbdev/sm712fb.c: In function 'smtc_blank':drivers/video/fbdev/sm712fb.c:900:4: warning: this statement may fall through [-Wimplicit-fallthrough=]
smtc_seqw(0x6b, 0x02);
^~~~~~~~~~~~~~~~~~~~~drivers/video/fbdev/sm712fb.c:901:3: note: here
case 0x720:
^~~~
Introduced by commit
f627caf55b8e ("fbdev: sm712fb: fix crashes and garbled display during DPMS modesetting")
I get this warning because I am building with -Wimplicit-fallthrough in attempt to catch new additions early. The gcc warning can be turned off by adding a /* fall through */ comment at the point the fall through happens (assuming that the fall through is intentional).
Signature · 2 lines
Cheers, Stephen Rothwell
Quoted 13 lines · Stephen Rothwell
Hi Bartlomiej,
After merging the fbdev tree, today's linux-next build (
x86_64allmodconfig) produced this warning:
drivers/video/fbdev/sm712fb.c: In function 'smtc_blank':drivers/video/fbdev/sm712fb.c:900:4: warning: this statement may fall through [-Wimplicit-fallthrough=]smtc_seqw(0x6b, 0x02); ^~~~~~~~~~~~~~~~~~~~~ drivers/video/fbdev/sm712fb.c:901:3: note: here case 0x720: ^~~~
Quoted 4 lines
Introduced by commit
f627caf55b8e("fbdev: sm712fb: fix crashes and garbled display during DPMS modesetting")
Nice catch! Thanks!
This bug was introduced by me while attempting to fix another issue, a result of my copy-paste error. Since it only reprograms the clock to a different frequency, it's only a benign issue without visible side-effect, so it also evaded Sudip Mukherjee's code review and regression tests.
But what's I'm more concerned here is the failure of scripts/checkpatch.pl. I thought ./checkpatch.pl should have caught it, but for some reasons it cannot detect this one.
$ ./scripts/checkpatch.pl 0001-fbdev-sm712fb-fix-crashes-and-garbled-display-during.patch total: 0 errors, 0 warnings, 105 lines checked
So I mistakenly assumed the patch doesn't have a problem... It seems checkpatch.pl cannot detect fallthroughs in nested switch/case statements? I'm not sure. Should I report it to the maintainers of checkpatch.pl?
Anyway, please apply the following patch ASAP.
Thanks,
Tom Li
From 040fa4e6cc8b338cd845c11fd3efd7394ca55108 Mon Sep 17 00:00:00 2001
From: Yifeng Li <[email protected]>
Date: Tue, 2 Apr 2019 20:25:20 +0800
Subject: [PATCH] fbdev: sm712fb: fix memory frequency by avoiding a
switch/case fallthrough.
A fallthrough in switch/case was introduced in f627caf55b8e ("fbdev:
sm712fb: fix crashes and garbled display during DPMS modesetting"), due to my copy-paste error, which would cause the memory clock frequency for SM720 to be programmed to SM712.
Since it only reprograms the clock to a different frequency, it's only a benign issue without visible side-effect, so it also evaded Sudip Mukherjee's code review and regression tests. scripts/checkpatch.pl also failed to discover the issue, possibly due to nested switch statements.
This issue was found by Stephen Rothwell by building linux-next with -Wimplicit-fallthrough.
--- drivers/video/fbdev/sm712fb.c | 1 + 1 file changed, 1 insertion(+)
drivers/video/fbdev/sm712fb.c +1 -0
@@ -898,6 +898,7 @@ static int smtc_blank(int blank_mode, struct fb_info *info)case 0x712 :smtc_seqw (0x6a ,0x16 );smtc_seqw (0x6b ,0x02 ); +break ;case 0x720 :smtc_seqw (0x6a ,0x0d );smtc_seqw (0x6b ,0x02 );
Signature · 1 line
2.20.1
Bartlomiej Zolnierkiewicz
AppliedQuoted 59 lines · Tom Li
Quoted 13 lines · Stephen Rothwell
Hi Bartlomiej,
After merging the fbdev tree, today's linux-next build (
x86_64allmodconfig) produced this warning:
drivers/video/fbdev/sm712fb.c: In function 'smtc_blank':drivers/video/fbdev/sm712fb.c:900:4: warning: this statement may fall through [-Wimplicit-fallthrough=]smtc_seqw(0x6b, 0x02); ^~~~~~~~~~~~~~~~~~~~~ drivers/video/fbdev/sm712fb.c:901:3: note: here case 0x720: ^~~~Quoted 4 lines
Introduced by commit
f627caf55b8e("fbdev: sm712fb: fix crashes and garbled display during DPMS modesetting")Nice catch! Thanks!
This bug was introduced by me while attempting to fix another issue, a result of my copy-paste error. Since it only reprograms the clock to a different frequency, it's only a benign issue without visible side-effect, so it also evaded Sudip Mukherjee's code review and regression tests.
But what's I'm more concerned here is the failure of
scripts/checkpatch.pl. I thought ./checkpatch.pl should have caught it, but for some reasons it cannot detect this one.$ ./scripts/checkpatch.pl 0001-fbdev-sm712fb-fix-crashes-and-garbled-display-during.patch total: 0 errors, 0 warnings, 105 lines checkedSo I mistakenly assumed the patch doesn't have a problem... It seems checkpatch.pl cannot detect fallthroughs in nested switch/case statements? I'm not sure. Should I report it to the maintainers of checkpatch.pl?
Anyway, please apply the following patch ASAP.
Thanks,
Tom LiQuoted 1 line
From
040fa4e6cc8b338cd845c11fd3efd7394ca55108Mon Sep 17 00:00:00 2001From: Yifeng Li <[email protected]>
Date: Tue, 2 Apr 2019 20:25:20 +0800
Subject: [PATCH] fbdev: sm712fb: fix memory frequency by avoiding a
switch/case fallthrough.A fallthrough in switch/case was introduced in
f627caf55b8e("fbdev:
sm712fb: fix crashes and garbled display during DPMS modesetting"), due to my copy-paste error, which would cause the memory clock frequency for SM720 to be programmed to SM712.Since it only reprograms the clock to a different frequency, it's only a benign issue without visible side-effect, so it also evaded Sudip Mukherjee's code review and regression tests.
scripts/checkpatch.plalso failed to discover the issue, possibly due to nested switch statements.
Quoted 6 lines
This issue was found by Stephen Rothwell by building linux-next with -Wimplicit-fallthrough.
Reported-by Stephen Rothwell <[email protected]>Fixes f627caf55b8e ("fbdev: sm712fb: fix crashes and garbled display during DPMS modesetting")Signed-off-by Yifeng Li <[email protected]>
Applied to fbdev-for-next, thanks!
Quoted 9 lines
--- drivers/video/fbdev/sm712fb.c | 1 + 1 file changed, 1 insertion(+)drivers/video/fbdev/sm712fb.c +0
-0
drivers/video/fbdev/sm712fb.c static int smtc_blank(int blank_mode, struct fb_info *info) · line 904
Quoted 7 lines
drivers/video/fbdev/sm712fb.c +1
-0@@ -898,6 +898,7 @@ static int smtc_blank(int blank_mode, struct fb_info *info)case 0x712 :smtc_seqw (0x6a ,0x16 );smtc_seqw (0x6b ,0x02 ); +break ;case 0x720 :smtc_seqw (0x6a ,0x0d );smtc_seqw (0x6b ,0x02 );
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics