summaryrefslogtreecommitdiff
path: root/drivers/media/video/em28xx/em28xx-audio.c
diff options
context:
space:
mode:
authorDouglas Schilling Landgraf <dougsland@redhat.com>2009-01-26 01:19:23 +0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 19:42:28 +0400
commitb124d597496fad3ba1ead7ed3b6c197c5b0a2ee7 (patch)
tree3f8c565460c944097858dd6d3c483aa1881224e4 /drivers/media/video/em28xx/em28xx-audio.c
parent00bc0645f02ec0c3486a9f6af9b6167ce5eda62c (diff)
downloadlinux-b124d597496fad3ba1ead7ed3b6c197c5b0a2ee7.tar.xz
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: Douglas Schilling Landgraf <dougsland@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/em28xx/em28xx-audio.c')
-rw-r--r--drivers/media/video/em28xx/em28xx-audio.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/media/video/em28xx/em28xx-audio.c b/drivers/media/video/em28xx/em28xx-audio.c
index 7a62c77b8485..43e8d7d91a96 100644
--- a/drivers/media/video/em28xx/em28xx-audio.c
+++ b/drivers/media/video/em28xx/em28xx-audio.c
@@ -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) {
- 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;