summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/em28xx/em28xx-audio.c
diff options
context:
space:
mode:
authorDouglas Schilling Landgraf <dougsland@redhat.com>2009-01-25 20:19:23 -0200
committerDouglas Schilling Landgraf <dougsland@redhat.com>2009-01-25 20:19:23 -0200
commit6af1615ac94a5752ea7bf0b3e02ebe2030a32f0e (patch)
treeb3109b48d01502e2969474aacc937a200d7758f9 /linux/drivers/media/video/em28xx/em28xx-audio.c
parent1c4acbfba514ff97e939c530ec86a0c95ec8e656 (diff)
downloadmediapointer-dvb-s2-6af1615ac94a5752ea7bf0b3e02ebe2030a32f0e.tar.gz
mediapointer-dvb-s2-6af1615ac94a5752ea7bf0b3e02ebe2030a32f0e.tar.bz2
em28xx: Add check before call em28xx_isoc_audio_deinit()
From: Douglas Schilling Landgraf <dougsland@redhat.com> Just call em28xx_isoc_audio_deinit() if em28xx sent a usb_submit(). Priority: normal Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Diffstat (limited to 'linux/drivers/media/video/em28xx/em28xx-audio.c')
-rw-r--r--linux/drivers/media/video/em28xx/em28xx-audio.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/linux/drivers/media/video/em28xx/em28xx-audio.c b/linux/drivers/media/video/em28xx/em28xx-audio.c
index ebbc64b3a..fcf21a614 100644
--- a/linux/drivers/media/video/em28xx/em28xx-audio.c
+++ b/linux/drivers/media/video/em28xx/em28xx-audio.c
@@ -62,7 +62,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
@@ -74,6 +74,7 @@ static int em28xx_isoc_audio_deinit(struct em28xx *dev)
dev->adev.transfer_buffer[i] = NULL;
}
+ dev->isoc_ctl.num_bufs = 0;
return 0;
}
@@ -178,6 +179,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;
@@ -219,10 +222,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;