Commit 5149fe2c15e2dfe349bfde27e1fea5593b40671f

Authored by Oliver Neukum
Committed by Jaroslav Kysela
1 parent 15944806e2

[ALSA] missing error check in usb sound driver

usb_set_interface() can fail, even for altsetting 0

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>

Showing 1 changed file with 5 additions and 1 deletions Side-by-side Diff

sound/usb/usbaudio.c
... ... @@ -1308,7 +1308,11 @@
1308 1308  
1309 1309 /* close the old interface */
1310 1310 if (subs->interface >= 0 && subs->interface != fmt->iface) {
1311   - usb_set_interface(subs->dev, subs->interface, 0);
  1311 + if (usb_set_interface(subs->dev, subs->interface, 0) < 0) {
  1312 + snd_printk(KERN_ERR "%d:%d:%d: return to setting 0 failed\n",
  1313 + dev->devnum, fmt->iface, fmt->altsetting);
  1314 + return -EIO;
  1315 + }
1312 1316 subs->interface = -1;
1313 1317 subs->format = 0;
1314 1318 }