提交 b124d597 编写于 作者: D Douglas Schilling Landgraf 提交者: Mauro Carvalho Chehab

V4L/DVB (10327): em28xx: Add check before call em28xx_isoc_audio_deinit()

Just call em28xx_isoc_audio_deinit() if em28xx sent a usb_submit().
Signed-off-by: NDouglas Schilling Landgraf <dougsland@redhat.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 00bc0645
......@@ -61,7 +61,7 @@ static int em28xx_isoc_audio_deinit(struct em28xx *dev)
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
......@@ -73,6 +73,7 @@ static int em28xx_isoc_audio_deinit(struct em28xx *dev)
dev->adev.transfer_buffer[i] = NULL;
}
dev->isoc_ctl.num_bufs = 0;
return 0;
}
......@@ -156,6 +157,8 @@ static int em28xx_init_audio_isoc(struct em28xx *dev)
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;
......@@ -197,10 +200,19 @@ static int em28xx_init_audio_isoc(struct em28xx *dev)
for (i = 0; i < EM28XX_AUDIO_BUFS; i++) {
errCode = usb_submit_urb(dev->adev.urb[i], GFP_ATOMIC);
if (errCode) {
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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册