diff options
author | Douglas Schilling Landgraf <dougsland@redhat.com> | 2009-01-25 17:19:23 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 11:42:28 -0400 |
commit | b124d597496fad3ba1ead7ed3b6c197c5b0a2ee7 (patch) | |
tree | 3f8c565460c944097858dd6d3c483aa1881224e4 /drivers/media/video/em28xx | |
parent | 00bc0645f02ec0c3486a9f6af9b6167ce5eda62c (diff) |
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')
-rw-r--r-- | drivers/media/video/em28xx/em28xx-audio.c | 16 |
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) | |||
61 | int i; | 61 | int i; |
62 | 62 | ||
63 | dprintk("Stopping isoc\n"); | 63 | dprintk("Stopping isoc\n"); |
64 | for (i = 0; i < EM28XX_AUDIO_BUFS; i++) { | 64 | for (i = 0; i < dev->isoc_ctl.num_bufs; i++) { |
65 | if (!irqs_disabled()) | 65 | if (!irqs_disabled()) |
66 | usb_kill_urb(dev->adev.urb[i]); | 66 | usb_kill_urb(dev->adev.urb[i]); |
67 | else | 67 | else |
@@ -73,6 +73,7 @@ static int em28xx_isoc_audio_deinit(struct em28xx *dev) | |||
73 | dev->adev.transfer_buffer[i] = NULL; | 73 | dev->adev.transfer_buffer[i] = NULL; |
74 | } | 74 | } |
75 | 75 | ||
76 | dev->isoc_ctl.num_bufs = 0; | ||
76 | return 0; | 77 | return 0; |
77 | } | 78 | } |
78 | 79 | ||
@@ -156,6 +157,8 @@ static int em28xx_init_audio_isoc(struct em28xx *dev) | |||
156 | 157 | ||
157 | dprintk("Starting isoc transfers\n"); | 158 | dprintk("Starting isoc transfers\n"); |
158 | 159 | ||
160 | dev->isoc_ctl.num_bufs = 0; | ||
161 | |||
159 | for (i = 0; i < EM28XX_AUDIO_BUFS; i++) { | 162 | for (i = 0; i < EM28XX_AUDIO_BUFS; i++) { |
160 | struct urb *urb; | 163 | struct urb *urb; |
161 | int j, k; | 164 | int j, k; |
@@ -197,10 +200,19 @@ static int em28xx_init_audio_isoc(struct em28xx *dev) | |||
197 | for (i = 0; i < EM28XX_AUDIO_BUFS; i++) { | 200 | for (i = 0; i < EM28XX_AUDIO_BUFS; i++) { |
198 | errCode = usb_submit_urb(dev->adev.urb[i], GFP_ATOMIC); | 201 | errCode = usb_submit_urb(dev->adev.urb[i], GFP_ATOMIC); |
199 | if (errCode) { | 202 | if (errCode) { |
200 | em28xx_isoc_audio_deinit(dev); | 203 | if (dev->isoc_ctl.num_bufs == 0) { |
204 | usb_free_urb(dev->adev.urb[i]); | ||
205 | dev->adev.urb[i] = NULL; | ||
206 | kfree(dev->adev.transfer_buffer[i]); | ||
207 | dev->adev.transfer_buffer[i] = NULL; | ||
208 | } else | ||
209 | em28xx_isoc_audio_deinit(dev); | ||
201 | 210 | ||
202 | return errCode; | 211 | return errCode; |
203 | } | 212 | } |
213 | mutex_lock(&dev->lock); | ||
214 | dev->isoc_ctl.num_bufs++; | ||
215 | mutex_unlock(&dev->lock); | ||
204 | } | 216 | } |
205 | 217 | ||
206 | return 0; | 218 | return 0; |