patch-2.4.19 linux-2.4.19/drivers/sound/es1370.c
Next file: linux-2.4.19/drivers/sound/es1371.c
Previous file: linux-2.4.19/drivers/sound/emu10k1/voicemgr.c
Back to the patch index
Back to the overall index
- Lines: 57
- Date:
Fri Aug 2 17:39:44 2002
- Orig file:
linux-2.4.18/drivers/sound/es1370.c
- Orig date:
Mon Feb 25 11:38:06 2002
diff -urN linux-2.4.18/drivers/sound/es1370.c linux-2.4.19/drivers/sound/es1370.c
@@ -397,7 +397,7 @@
* so that it cannot wreak havoc. The attribute makes sure it doesn't
* cross a page boundary and ensures dword alignment for the DMA engine
*/
-static unsigned char bugbuf[16] __attribute__ ((aligned (16)));
+static unsigned char *bugbuf; // [16] __attribute__ ((aligned (16)));
/* --------------------------------------------------------------------- */
@@ -1638,7 +1638,7 @@
if (s->dma_adc.mapped)
s->dma_adc.count &= s->dma_adc.fragsize-1;
spin_unlock_irqrestore(&s->lock, flags);
- return copy_to_user((void *)arg, &cinfo, sizeof(cinfo));
+ return copy_to_user((void *)arg, &cinfo, sizeof(cinfo)) ? -EFAULT : 0;
case SNDCTL_DSP_GETOPTR:
if (!(file->f_mode & FMODE_WRITE))
@@ -1656,7 +1656,7 @@
if (s->dma_dac2.mapped)
s->dma_dac2.count &= s->dma_dac2.fragsize-1;
spin_unlock_irqrestore(&s->lock, flags);
- return copy_to_user((void *)arg, &cinfo, sizeof(cinfo));
+ return copy_to_user((void *)arg, &cinfo, sizeof(cinfo)) ? -EFAULT : 0;
case SNDCTL_DSP_GETBLKSIZE:
if (file->f_mode & FMODE_WRITE) {
@@ -2115,7 +2115,7 @@
if (s->dma_dac1.mapped)
s->dma_dac1.count &= s->dma_dac1.fragsize-1;
spin_unlock_irqrestore(&s->lock, flags);
- return copy_to_user((void *)arg, &cinfo, sizeof(cinfo));
+ return copy_to_user((void *)arg, &cinfo, sizeof(cinfo)) ? -EFAULT : 0;
case SNDCTL_DSP_GETBLKSIZE:
if ((val = prog_dmabuf_dac1(s)))
@@ -2564,6 +2564,11 @@
mm_segment_t fs;
int i, val, ret;
+ if (bugbuf == NULL)
+ bugbuf = kmalloc(16, GFP_KERNEL);
+ if (bugbuf == NULL)
+ return -ENOMEM;
+
if ((ret=pci_enable_device(pcidev)))
return ret;
@@ -2747,6 +2752,8 @@
{
printk(KERN_INFO "es1370: unloading\n");
pci_unregister_driver(&es1370_driver);
+ if(bugbuf)
+ kfree(bugbuf);
}
module_init(init_es1370);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)