aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Krakora <rob.krakora@messagenetsystems.com>2009-02-08 11:09:11 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:42:44 -0400
commitaa5a1821859c9c2915bc00e79f6e01e619df6e8f (patch)
tree9d00a558f3f3e8ba4ec624edc7e59ba8e1e0cc96
parent3e099baff451affd13a93c6fed216943e01b80fd (diff)
V4L/DVB (10518): em28xx: Fix for em28xx memory leak and function rename
Fix for em28xx memory leak and function rename Signed-off-by: Robert Krakora <rob.krakora@messagenetsystems.com> Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/video/em28xx/em28xx-audio.c22
-rw-r--r--drivers/media/video/em28xx/em28xx-core.c13
2 files changed, 31 insertions, 4 deletions
diff --git a/drivers/media/video/em28xx/em28xx-audio.c b/drivers/media/video/em28xx/em28xx-audio.c
index 7a62c77b8485..c698d3c9690f 100644
--- a/drivers/media/video/em28xx/em28xx-audio.c
+++ b/drivers/media/video/em28xx/em28xx-audio.c
@@ -56,7 +56,7 @@ MODULE_PARM_DESC(debug, "activates debug info");
56 56
57static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 57static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
58 58
59static int em28xx_isoc_audio_deinit(struct em28xx *dev) 59static int em28xx_deinit_isoc_audio(struct em28xx *dev)
60{ 60{
61 int i; 61 int i;
62 62
@@ -66,6 +66,7 @@ static int em28xx_isoc_audio_deinit(struct em28xx *dev)
66 usb_kill_urb(dev->adev.urb[i]); 66 usb_kill_urb(dev->adev.urb[i]);
67 else 67 else
68 usb_unlink_urb(dev->adev.urb[i]); 68 usb_unlink_urb(dev->adev.urb[i]);
69
69 usb_free_urb(dev->adev.urb[i]); 70 usb_free_urb(dev->adev.urb[i]);
70 dev->adev.urb[i] = NULL; 71 dev->adev.urb[i] = NULL;
71 72
@@ -87,6 +88,20 @@ static void em28xx_audio_isocirq(struct urb *urb)
87 unsigned int stride; 88 unsigned int stride;
88 struct snd_pcm_substream *substream; 89 struct snd_pcm_substream *substream;
89 struct snd_pcm_runtime *runtime; 90 struct snd_pcm_runtime *runtime;
91
92 switch (urb->status) {
93 case 0: /* success */
94 case -ETIMEDOUT: /* NAK */
95 break;
96 case -ECONNRESET: /* kill */
97 case -ENOENT:
98 case -ESHUTDOWN:
99 return;
100 default: /* error */
101 dprintk("urb completition error %d.\n", urb->status);
102 break;
103 }
104
90 if (dev->adev.capture_pcm_substream) { 105 if (dev->adev.capture_pcm_substream) {
91 substream = dev->adev.capture_pcm_substream; 106 substream = dev->adev.capture_pcm_substream;
92 runtime = substream->runtime; 107 runtime = substream->runtime;
@@ -197,8 +212,7 @@ static int em28xx_init_audio_isoc(struct em28xx *dev)
197 for (i = 0; i < EM28XX_AUDIO_BUFS; i++) { 212 for (i = 0; i < EM28XX_AUDIO_BUFS; i++) {
198 errCode = usb_submit_urb(dev->adev.urb[i], GFP_ATOMIC); 213 errCode = usb_submit_urb(dev->adev.urb[i], GFP_ATOMIC);
199 if (errCode) { 214 if (errCode) {
200 em28xx_isoc_audio_deinit(dev); 215 em28xx_deinit_isoc_audio(dev);
201
202 return errCode; 216 return errCode;
203 } 217 }
204 } 218 }
@@ -218,7 +232,7 @@ static int em28xx_cmd(struct em28xx *dev, int cmd, int arg)
218 em28xx_init_audio_isoc(dev); 232 em28xx_init_audio_isoc(dev);
219 } else if (dev->adev.capture_stream == STREAM_ON && arg == 0) { 233 } else if (dev->adev.capture_stream == STREAM_ON && arg == 0) {
220 dev->adev.capture_stream = STREAM_OFF; 234 dev->adev.capture_stream = STREAM_OFF;
221 em28xx_isoc_audio_deinit(dev); 235 em28xx_deinit_isoc_audio(dev);
222 } else { 236 } else {
223 printk(KERN_ERR "An underrun very likely occurred. " 237 printk(KERN_ERR "An underrun very likely occurred. "
224 "Ignoring it.\n"); 238 "Ignoring it.\n");
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c
index 3ac8ce0adec3..43f1d0e4c549 100644
--- a/drivers/media/video/em28xx/em28xx-core.c
+++ b/drivers/media/video/em28xx/em28xx-core.c
@@ -827,6 +827,19 @@ static void em28xx_irq_callback(struct urb *urb)
827 struct em28xx *dev = container_of(dma_q, struct em28xx, vidq); 827 struct em28xx *dev = container_of(dma_q, struct em28xx, vidq);
828 int rc, i; 828 int rc, i;
829 829
830 switch (urb->status) {
831 case 0: /* success */
832 case -ETIMEDOUT: /* NAK */
833 break;
834 case -ECONNRESET: /* kill */
835 case -ENOENT:
836 case -ESHUTDOWN:
837 return;
838 default: /* error */
839 em28xx_isocdbg("urb completition error %d.\n", urb->status);
840 break;
841 }
842
830 /* Copy data from URB */ 843 /* Copy data from URB */
831 spin_lock(&dev->slock); 844 spin_lock(&dev->slock);
832 rc = dev->isoc_ctl.isoc_copy(dev, urb); 845 rc = dev->isoc_ctl.isoc_copy(dev, urb);