Skip to contentSkip to conversation

sound: ppc: beep: fix clang -Wimplicit-fallthrough

PATCH Applied Anders Roxell 2 participants 2 messages Dec 7, 2021 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sound: ppc: beep: fix clang -Wimplicit-fallthrough

Clang warns:

sound/ppc/beep.c:103:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]

        case SND_TONE: break;
        ^
sound/ppc/beep.c:103:2: note: insert 'break;' to avoid fall-through
        case SND_TONE: break;
        ^
        break;

1 warning 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.

---
 sound/ppc/beep.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/ppc/beep.c +1 -1
index 0f4bce1c0d4f..bf289783eafd 100644
@@ -99,7 +99,7 @@ static int snd_pmac_beep_event(struct input_dev *dev, unsigned int type,
 		return -1;
 
 	switch (code) {
-	case SND_BELL: if (hz) hz = 1000;
+	case SND_BELL: if (hz) hz = 1000; break;
 	case SND_TONE: break;
 	default: return -1;
 	}
Signature · 1 line
2.33.0
Applied
#1 lore raw
Quoted 12 lines · Anders Roxell

Clang warns:

sound/ppc/beep.c:103:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]

        case SND_TONE: break;
        ^
sound/ppc/beep.c:103:2: note: insert 'break;' to avoid fall-through
        case SND_TONE: break;
        ^
        break;

1 warning generated.

Quoted 7 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.

Thanks, applied.

Takashi