[alsa-devel] [PATCH 0/4] ALSA: Mark expected switch fall-throughs
Hi all,
In preparation to enabling -Wimplicit-fallthrough, this patchset aims to add some annotations in order to mark switch cases where we are expecting to fall through.
Thanks
Gustavo A. R. Silva (4): ALSA: galaxy: Mark expected switch fall-through ALSA: opti92x: mark expected switch fall-through ALSA: opti9xx: mark expected switch fall-through ALSA: es18xx: mark expected switch fall-through
sound/isa/es18xx.c | 1 + sound/isa/galaxy/galaxy.c | 3 +++ sound/isa/opti9xx/miro.c | 5 +++++ sound/isa/opti9xx/opti92x-ad1848.c | 3 +++ 4 files changed, 12 insertions(+)
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.
Addresses-Coverity-ID: 1468367 ("Missing break in switch") Addresses-Coverity-ID: 115037 ("Missing break in switch") Addresses-Coverity-ID: 115038 ("Missing break in switch") Signed-off-by: Gustavo A. R. Silva gustavo@embeddedor.com --- sound/isa/galaxy/galaxy.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/sound/isa/galaxy/galaxy.c b/sound/isa/galaxy/galaxy.c index b9994cc..af9eea4 100644 --- a/sound/isa/galaxy/galaxy.c +++ b/sound/isa/galaxy/galaxy.c @@ -260,6 +260,7 @@ static int snd_galaxy_match(struct device *dev, unsigned int n) break; case 2: irq[n] = 9; + /* Fall through */ case 9: wss_config[n] |= WSS_CONFIG_IRQ_9; break; @@ -304,6 +305,7 @@ static int snd_galaxy_match(struct device *dev, unsigned int n) case 1: if (dma1[n] == 0) break; + /* Fall through */ default: dev_err(dev, "invalid capture DMA %d\n", dma2[n]); return 0; @@ -333,6 +335,7 @@ static int snd_galaxy_match(struct device *dev, unsigned int n) break; case 2: mpu_irq[n] = 9; + /* Fall through */ case 9: config[n] |= GALAXY_CONFIG_MPUIRQ_2; break;
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.
Addresses-Coverity-ID: 1165394 ("Missing break in switch") Addresses-Coverity-ID: 1167851 ("Missing break in switch") Addresses-Coverity-ID: 402015 ("Missing break in switch") Signed-off-by: Gustavo A. R. Silva gustavo@embeddedor.com --- sound/isa/opti9xx/opti92x-ad1848.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c index 505cd81..ac0ab6e 100644 --- a/sound/isa/opti9xx/opti92x-ad1848.c +++ b/sound/isa/opti9xx/opti92x-ad1848.c @@ -261,6 +261,7 @@ static unsigned char snd_opti9xx_read(struct snd_opti9xx *chip, retval = inb(chip->mc_base + 9); break; } + /* Fall through */
case OPTi9XX_HW_82C928: case OPTi9XX_HW_82C929: @@ -303,6 +304,7 @@ static void snd_opti9xx_write(struct snd_opti9xx *chip, unsigned char reg, outb(value, chip->mc_base + 9); break; } + /* Fall through */
case OPTi9XX_HW_82C928: case OPTi9XX_HW_82C929: @@ -350,6 +352,7 @@ static int snd_opti9xx_configure(struct snd_opti9xx *chip, snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(4), 0xf0, 0xfc); /* enable wave audio */ snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(6), 0x02, 0x02); + /* Fall through */
case OPTi9XX_HW_82C925: /* enable WSS mode */
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.
Addresses-Coverity-ID: 402016 ("Missing break in switch") Addresses-Coverity-ID: 1056542 ("Missing break in switch") Addresses-Coverity-ID: 1339579 ("Missing break in switch") Addresses-Coverity-ID: 1369526 ("Missing break in switch") Addresses-Coverity-ID: 1369529 ("Missing break in switch") Signed-off-by: Gustavo A. R. Silva gustavo@embeddedor.com --- sound/isa/opti9xx/miro.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/sound/isa/opti9xx/miro.c b/sound/isa/opti9xx/miro.c index 8894c7c..c6136c6 100644 --- a/sound/isa/opti9xx/miro.c +++ b/sound/isa/opti9xx/miro.c @@ -176,10 +176,13 @@ static int aci_busy_wait(struct snd_miro_aci *aci) switch (timeout-ACI_MINTIME) { case 0 ... 9: out /= 10; + /* fall through */ case 10 ... 19: out /= 10; + /* fall through */ case 20 ... 30: out /= 10; + /* fall through */ default: set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout(out); @@ -834,6 +837,7 @@ static unsigned char snd_miro_read(struct snd_miro *chip, retval = inb(chip->mc_base + 9); break; } + /* fall through */
case OPTi9XX_HW_82C929: retval = inb(chip->mc_base + reg); @@ -863,6 +867,7 @@ static void snd_miro_write(struct snd_miro *chip, unsigned char reg, outb(value, chip->mc_base + 9); break; } + /* fall through */
case OPTi9XX_HW_82C929: outb(value, chip->mc_base + reg);
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.
Addresses-Coverity-ID: 115075 ("Missing break in switch") Signed-off-by: Gustavo A. R. Silva gustavo@embeddedor.com --- sound/isa/es18xx.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index 2a6960c..0d103d6 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c @@ -1024,6 +1024,7 @@ static int snd_es18xx_put_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem val = 3; } else retVal = snd_es18xx_mixer_bits(chip, 0x7a, 0x08, 0x00) != 0x00; + /* fall through */ /* 4 source chips */ case 0x1868: case 0x1878:
On Thu, 02 Aug 2018 22:40:08 +0200, Gustavo A. R. Silva wrote:
Hi all,
In preparation to enabling -Wimplicit-fallthrough, this patchset aims to add some annotations in order to mark switch cases where we are expecting to fall through.
Thanks
Gustavo A. R. Silva (4): ALSA: galaxy: Mark expected switch fall-through ALSA: opti92x: mark expected switch fall-through ALSA: opti9xx: mark expected switch fall-through ALSA: es18xx: mark expected switch fall-through
Applied all four patches now. Thanks.
Takashi
participants (2)
-
Gustavo A. R. Silva
-
Takashi Iwai