alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sound: ppc: beep: fix clang -Wimplicit-fallthrough
@ 2021-12-07 11:00 Anders Roxell
  2021-12-07 14:37 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Anders Roxell @ 2021-12-07 11:00 UTC (permalink / raw)
  To: perex, tiwai
  Cc: alsa-devel, Anders Roxell, Naresh Kamboju, llvm, ndesaulniers,
	linux-kernel, nathan

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.

Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
---
 sound/ppc/beep.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/ppc/beep.c b/sound/ppc/beep.c
index 0f4bce1c0d4f..bf289783eafd 100644
--- a/sound/ppc/beep.c
+++ b/sound/ppc/beep.c
@@ -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;
 	}
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] sound: ppc: beep: fix clang -Wimplicit-fallthrough
  2021-12-07 11:00 [PATCH] sound: ppc: beep: fix clang -Wimplicit-fallthrough Anders Roxell
@ 2021-12-07 14:37 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2021-12-07 14:37 UTC (permalink / raw)
  To: Anders Roxell
  Cc: alsa-devel, Naresh Kamboju, llvm, ndesaulniers, linux-kernel,
	tiwai, nathan

On Tue, 07 Dec 2021 12:00:53 +0100,
Anders Roxell wrote:
> 
> 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.
> 
> Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>

Thanks, applied.


Takashi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-07 14:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-07 11:00 [PATCH] sound: ppc: beep: fix clang -Wimplicit-fallthrough Anders Roxell
2021-12-07 14:37 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).