Skip to contentSkip to conversation

ALSA: ca0106: fix error code handling

PATCH Applied Tong Zhang 2 participants 2 messages Aug 24, 2020 – Aug 25, 2020 Sound

lore
Share & tools
lore

Tong Zhang

author
#0 lore raw

PATCH 1/1 ALSA: ca0106: fix error code handling

snd_ca0106_spi_write() returns 1 on error, snd_ca0106_pcm_power_dac() is returning the error code directly, and the caller is expecting an negative error code

---
 sound/pci/ca0106/ca0106_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
sound/pci/ca0106/ca0106_main.c +2 -1
index 70d775ff967e..c189f70c82cb 100644
@@ -537,7 +537,8 @@ static int snd_ca0106_pcm_power_dac(struct snd_ca0106 *chip, int channel_id,
 		else
 			/* Power down */
 			chip->spi_dac_reg[reg] |= bit;
-		return snd_ca0106_spi_write(chip, chip->spi_dac_reg[reg]);
+		if (snd_ca0106_spi_write(chip, chip->spi_dac_reg[reg]) != 0)
+			return -ENXIO;
 	}
 	return 0;
 }
Signature · 1 line
2.25.1
Applied
#1 lore raw
Quoted 6 lines · Tong Zhang

snd_ca0106_spi_write() returns 1 on error, snd_ca0106_pcm_power_dac() is returning the error code directly, and the caller is expecting an negative error code

Thanks, applied with Cc to stable.

Takashi