Skip to contentSkip to conversation

powerpc: platforms: cell: pervasive: fix clang -Wimplicit-fallthrough

PATCH Applied Anders Roxell 5 participants 5 messages Dec 7, 2021 – Dec 15, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc: platforms: cell: pervasive: fix clang -Wimplicit-fallthrough

Clang warns:

arch/powerpc/platforms/cell/pervasive.c:81:2: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]

        case SRR1_WAKEEE:
        ^
arch/powerpc/platforms/cell/pervasive.c:81:2: note: insert 'break;' to avoid fall-through
        case SRR1_WAKEEE:
        ^
        break;

1 error generated.

Clang is more pedantic than GCC, which does not warn when failing through to a case that is just break or return. Clang's version is more in line with the kernel's own stance in deprecated.rst. Add athe missing break to silence the warning.

Fixes 6e83985b0f6e ("powerpc/cbe: Do not process external or decremeter interrupts from sreset")
---
 arch/powerpc/platforms/cell/pervasive.c | 1 +
 1 file changed, 1 insertion(+)
arch/powerpc/platforms/cell/pervasive.c +1 -0
index 5b9a7e9f144b..dff8d5e7ab82 100644
@@ -78,6 +78,7 @@ static int cbe_system_reset_exception(struct pt_regs *regs)
 	switch (regs->msr & SRR1_WAKEMASK) {
 	case SRR1_WAKEDEC:
 		set_dec(1);
+		break;
 	case SRR1_WAKEEE:
 		/*
 		 * Handle these when interrupts get re-enabled and we take
Signature · 1 line
2.33.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 12 lines · Anders Roxell

Clang warns:

arch/powerpc/platforms/cell/pervasive.c:81:2: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]

        case SRR1_WAKEEE:
        ^
arch/powerpc/platforms/cell/pervasive.c:81:2: note: insert 'break;' to avoid fall-through
        case SRR1_WAKEEE:
        ^
        break;

1 error generated.

Quoted 8 lines

Clang is more pedantic than GCC, which does not warn when failing through to a case that is just break or return. Clang's version is more in line with the kernel's own stance in deprecated.rst. Add athe missing break to silence the warning.

Fixes 6e83985b0f6e ("powerpc/cbe: Do not process external or decremeter interrupts from sreset")

Thanks for the fix!

Reviewed-by on v1 1/1
#2 lore raw
In reply to Anders Roxell
Quoted 9 lines · Anders Roxell

Clang warns:

arch/powerpc/platforms/cell/pervasive.c:81:2: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]

        case SRR1_WAKEEE:
        ^
arch/powerpc/platforms/cell/pervasive.c:81:2: note: insert 'break;' to avoid fall-through
        case SRR1_WAKEEE:
        ^
        break;
Quoted 6 lines

1 error generated.

Clang is more pedantic than GCC, which does not warn when failing through to a case that is just break or return. Clang's version is more in line with the kernel's own stance in deprecated.rst. Add athe missing break to silence the warning.

^ small typo, probably not worth a resend

Quoted 4 lines
Fixes 6e83985b0f6e ("powerpc/cbe: Do not process external or decremeter interrupts from sreset")
Quoted 19 lines
---
 arch/powerpc/platforms/cell/pervasive.c | 1 +
 1 file changed, 1 insertion(+)
arch/powerpc/platforms/cell/pervasive.c +1 -0
index 5b9a7e9f144b..dff8d5e7ab82 100644
@@ -78,6 +78,7 @@ static int cbe_system_reset_exception(struct pt_regs *regs)
 	switch (regs->msr & SRR1_WAKEMASK) {
 	case SRR1_WAKEDEC:
 		set_dec(1);
+		break;
 	case SRR1_WAKEEE:
 		/*
 		 * Handle these when interrupts get re-enabled and we take
Signature · 1 line
2.33.0
#3 lore raw
In reply to Anders Roxell
Quoted 28 lines · Anders Roxell

Clang warns:

arch/powerpc/platforms/cell/pervasive.c:81:2: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]

        case SRR1_WAKEEE:
        ^
arch/powerpc/platforms/cell/pervasive.c:81:2: note: insert 'break;' to avoid fall-through
        case SRR1_WAKEEE:
        ^
        break;

1 error generated.

Clang is more pedantic than GCC, which does not warn when failing through to a case that is just break or return. Clang's version is more in line with the kernel's own stance in deprecated.rst. Add athe missing break to silence the warning.

Fixes 6e83985b0f6e ("powerpc/cbe: Do not process external or decremeter interrupts from sreset")
---
 arch/powerpc/platforms/cell/pervasive.c | 1 +
 1 file changed, 1 insertion(+)
arch/powerpc/platforms/cell/pervasive.c +0 -0
index 5b9a7e9f144b..dff8d5e7ab82 100644

arch/powerpc/platforms/cell/pervasive.c static int cbe_system_reset_exception(struct pt_regs *regs) · line 84

Quoted 7 lines
arch/powerpc/platforms/cell/pervasive.c +1 -0
@@ -78,6 +78,7 @@ static int cbe_system_reset_exception(struct pt_regs *regs)
 	switch (regs->msr & SRR1_WAKEMASK) {
 	case SRR1_WAKEDEC:
 		set_dec(1);
+		break;
 	case SRR1_WAKEEE:
 		/*
 		 * Handle these when interrupts get re-enabled and we take

Thanks. I have definitely fixed this somewhere before, but I guess I never sent it upstream, or it's still lying in a git stash of mine.

cheers

#4 lore raw
In reply to Anders Roxell
Quoted 9 lines · Anders Roxell

Clang warns:

arch/powerpc/platforms/cell/pervasive.c:81:2: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]

        case SRR1_WAKEEE:
        ^
arch/powerpc/platforms/cell/pervasive.c:81:2: note: insert 'break;' to avoid fall-through
        case SRR1_WAKEEE:
        ^
        break;
Quoted 3 lines

1 error generated.

[...]

Applied to powerpc/next.

[1/1] powerpc: platforms: cell: pervasive: fix clang -Wimplicit-fallthrough

      https://git.kernel.org/powerpc/c/e89257e28e844f5d1d39081bb901d9f1183a7705

cheers