diff options
Diffstat (limited to 'sound/oss/swarm_cs4297a.c')
-rw-r--r-- | sound/oss/swarm_cs4297a.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/sound/oss/swarm_cs4297a.c b/sound/oss/swarm_cs4297a.c index 471c274c5000..016b918329ad 100644 --- a/sound/oss/swarm_cs4297a.c +++ b/sound/oss/swarm_cs4297a.c | |||
@@ -77,6 +77,7 @@ | |||
77 | #include <linux/poll.h> | 77 | #include <linux/poll.h> |
78 | #include <linux/smp_lock.h> | 78 | #include <linux/smp_lock.h> |
79 | #include <linux/mutex.h> | 79 | #include <linux/mutex.h> |
80 | #include <linux/kernel.h> | ||
80 | 81 | ||
81 | #include <asm/byteorder.h> | 82 | #include <asm/byteorder.h> |
82 | #include <asm/dma.h> | 83 | #include <asm/dma.h> |
@@ -615,25 +616,23 @@ static int init_serdma(serdma_t *dma) | |||
615 | 616 | ||
616 | /* Descriptors */ | 617 | /* Descriptors */ |
617 | dma->ringsz = DMA_DESCR; | 618 | dma->ringsz = DMA_DESCR; |
618 | dma->descrtab = kmalloc(dma->ringsz * sizeof(serdma_descr_t), GFP_KERNEL); | 619 | dma->descrtab = kzalloc(dma->ringsz * sizeof(serdma_descr_t), GFP_KERNEL); |
619 | if (!dma->descrtab) { | 620 | if (!dma->descrtab) { |
620 | printk(KERN_ERR "cs4297a: kmalloc descrtab failed\n"); | 621 | printk(KERN_ERR "cs4297a: kzalloc descrtab failed\n"); |
621 | return -1; | 622 | return -1; |
622 | } | 623 | } |
623 | memset(dma->descrtab, 0, dma->ringsz * sizeof(serdma_descr_t)); | ||
624 | dma->descrtab_end = dma->descrtab + dma->ringsz; | 624 | dma->descrtab_end = dma->descrtab + dma->ringsz; |
625 | /* XXX bloddy mess, use proper DMA API here ... */ | 625 | /* XXX bloddy mess, use proper DMA API here ... */ |
626 | dma->descrtab_phys = CPHYSADDR((long)dma->descrtab); | 626 | dma->descrtab_phys = CPHYSADDR((long)dma->descrtab); |
627 | dma->descr_add = dma->descr_rem = dma->descrtab; | 627 | dma->descr_add = dma->descr_rem = dma->descrtab; |
628 | 628 | ||
629 | /* Frame buffer area */ | 629 | /* Frame buffer area */ |
630 | dma->dma_buf = kmalloc(DMA_BUF_SIZE, GFP_KERNEL); | 630 | dma->dma_buf = kzalloc(DMA_BUF_SIZE, GFP_KERNEL); |
631 | if (!dma->dma_buf) { | 631 | if (!dma->dma_buf) { |
632 | printk(KERN_ERR "cs4297a: kmalloc dma_buf failed\n"); | 632 | printk(KERN_ERR "cs4297a: kzalloc dma_buf failed\n"); |
633 | kfree(dma->descrtab); | 633 | kfree(dma->descrtab); |
634 | return -1; | 634 | return -1; |
635 | } | 635 | } |
636 | memset(dma->dma_buf, 0, DMA_BUF_SIZE); | ||
637 | dma->dma_buf_phys = CPHYSADDR((long)dma->dma_buf); | 636 | dma->dma_buf_phys = CPHYSADDR((long)dma->dma_buf); |
638 | 637 | ||
639 | /* Samples buffer area */ | 638 | /* Samples buffer area */ |
@@ -2618,12 +2617,11 @@ static int __init cs4297a_init(void) | |||
2618 | udelay(100); | 2617 | udelay(100); |
2619 | #endif | 2618 | #endif |
2620 | 2619 | ||
2621 | if (!(s = kmalloc(sizeof(struct cs4297a_state), GFP_KERNEL))) { | 2620 | if (!(s = kzalloc(sizeof(struct cs4297a_state), GFP_KERNEL))) { |
2622 | CS_DBGOUT(CS_ERROR, 1, printk(KERN_ERR | 2621 | CS_DBGOUT(CS_ERROR, 1, printk(KERN_ERR |
2623 | "cs4297a: probe() no memory for state struct.\n")); | 2622 | "cs4297a: probe() no memory for state struct.\n")); |
2624 | return -1; | 2623 | return -1; |
2625 | } | 2624 | } |
2626 | memset(s, 0, sizeof(struct cs4297a_state)); | ||
2627 | s->magic = CS4297a_MAGIC; | 2625 | s->magic = CS4297a_MAGIC; |
2628 | init_waitqueue_head(&s->dma_adc.wait); | 2626 | init_waitqueue_head(&s->dma_adc.wait); |
2629 | init_waitqueue_head(&s->dma_dac.wait); | 2627 | init_waitqueue_head(&s->dma_dac.wait); |
@@ -2676,7 +2674,7 @@ static int __init cs4297a_init(void) | |||
2676 | #if 0 | 2674 | #if 0 |
2677 | val = SOUND_MASK_LINE; | 2675 | val = SOUND_MASK_LINE; |
2678 | mixer_ioctl(s, SOUND_MIXER_WRITE_RECSRC, (unsigned long) &val); | 2676 | mixer_ioctl(s, SOUND_MIXER_WRITE_RECSRC, (unsigned long) &val); |
2679 | for (i = 0; i < sizeof(initvol) / sizeof(initvol[0]); i++) { | 2677 | for (i = 0; i < ARRAY_SIZE(initvol); i++) { |
2680 | val = initvol[i].vol; | 2678 | val = initvol[i].vol; |
2681 | mixer_ioctl(s, initvol[i].mixch, (unsigned long) &val); | 2679 | mixer_ioctl(s, initvol[i].mixch, (unsigned long) &val); |
2682 | } | 2680 | } |