Skip to contentSkip to conversation

ALSA: Mark expected switch fall-throughs

PATCH Applied Gustavo A. R. Silva 2 participants 6 messages Aug 2, 2018 – Aug 3, 2018 Sound

lore
Share & tools
lore
#0 lore raw

cover 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(+)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/4 ALSA: galaxy: Mark expected switch fall-throughs

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")

---
 sound/isa/galaxy/galaxy.c | 3 +++
 1 file changed, 3 insertions(+)
sound/isa/galaxy/galaxy.c +3 -0
index b9994cc..af9eea4 100644
@@ -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;
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/4 ALSA: opti92x: mark expected switch fall-throughs

In reply to Gustavo A. R. Silva

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")

---
 sound/isa/opti9xx/opti92x-ad1848.c | 3 +++
 1 file changed, 3 insertions(+)
sound/isa/opti9xx/opti92x-ad1848.c +3 -0
index 505cd81..ac0ab6e 100644
@@ -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 */
Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/4 ALSA: opti9xx: mark expected switch fall-throughs

In reply to Gustavo A. R. Silva

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")

---
 sound/isa/opti9xx/miro.c | 5 +++++
 1 file changed, 5 insertions(+)
sound/isa/opti9xx/miro.c +5 -0
index 8894c7c..c6136c6 100644
@@ -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);
Signature · 1 line
2.7.4
#4 lore raw

PATCH 4/4 ALSA: es18xx: mark expected switch fall-through

In reply to Gustavo A. R. Silva

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.

Addresses-Coverity-ID: 115075 ("Missing break in switch")

---
 sound/isa/es18xx.c | 1 +
 1 file changed, 1 insertion(+)
sound/isa/es18xx.c +1 -0
index 2a6960c..0d103d6 100644
@@ -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:
Signature · 1 line
2.7.4
Applied
#5 lore raw
In reply to Gustavo A. R. Silva
Quoted 7 lines · Gustavo A. R. Silva

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.

Quoted 7 lines

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