Skip to content

Commit

Permalink
ALSA: ice1712: fix a missing check of snd_i2c_sendbytes
Browse files Browse the repository at this point in the history
snd_i2c_sendbytes could fail. The fix checks its return value: if it
fails, issues an error message and returns with its error code.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Aditya Pakki authored and Takashi Iwai committed Jan 7, 2019
1 parent 0f25e00 commit c99776c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion sound/pci/ice1712/ews.c
Original file line number Diff line number Diff line change
@@ -826,7 +826,12 @@ static int snd_ice1712_6fire_read_pca(struct snd_ice1712 *ice, unsigned char reg

snd_i2c_lock(ice->i2c);
byte = reg;
snd_i2c_sendbytes(spec->i2cdevs[EWS_I2C_6FIRE], &byte, 1);
if (snd_i2c_sendbytes(spec->i2cdevs[EWS_I2C_6FIRE], &byte, 1)) {
snd_i2c_unlock(ice->i2c);
dev_err(ice->card->dev, "cannot send pca\n");
return -EIO;
}

byte = 0;
if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_6FIRE], &byte, 1) != 1) {
snd_i2c_unlock(ice->i2c);

0 comments on commit c99776c

Please sign in to comment.