int i;
dprintk("Stopping isoc\n");
- for (i = 0; i < EM28XX_AUDIO_BUFS; i++) {
+ for (i = 0; i < dev->isoc_ctl.num_bufs; i++) {
if (!irqs_disabled())
usb_kill_urb(dev->adev.urb[i]);
else
dev->adev.transfer_buffer[i] = NULL;
}
+ dev->isoc_ctl.num_bufs = 0;
return 0;
}
dprintk("Starting isoc transfers\n");
+ dev->isoc_ctl.num_bufs = 0;
+
for (i = 0; i < EM28XX_AUDIO_BUFS; i++) {
struct urb *urb;
int j, k;
for (i = 0; i < EM28XX_AUDIO_BUFS; i++) {
errCode = usb_submit_urb(dev->adev.urb[i], GFP_ATOMIC);
if (errCode) {
- em28xx_isoc_audio_deinit(dev);
+ if (dev->isoc_ctl.num_bufs == 0) {
+ usb_free_urb(dev->adev.urb[i]);
+ dev->adev.urb[i] = NULL;
+ kfree(dev->adev.transfer_buffer[i]);
+ dev->adev.transfer_buffer[i] = NULL;
+ } else
+ em28xx_isoc_audio_deinit(dev);
return errCode;
}
+ mutex_lock(&dev->lock);
+ dev->isoc_ctl.num_bufs++;
+ mutex_unlock(&dev->lock);
}
return 0;