diff options
author | Robert P. J. Day <rpjday@mindspring.com> | 2007-02-14 03:33:16 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-14 11:09:54 -0500 |
commit | 3159f06dc2303630c02d1ad2eeaeaf341414c9df (patch) | |
tree | 678779f605dac635df3932381933b3950a0052ba /sound/oss/swarm_cs4297a.c | |
parent | cd354f1ae75e6466a7e31b727faede57a1f89ca5 (diff) |
[PATCH] OSS: replace kmalloc()+memset() combos with kzalloc()
Replace kmalloc() + memset() pairs with the appropriate kzalloc() calls.
Signed-off-by: Robert P. J. Day <rpjday@mindspring.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'sound/oss/swarm_cs4297a.c')
-rw-r--r-- | sound/oss/swarm_cs4297a.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/sound/oss/swarm_cs4297a.c b/sound/oss/swarm_cs4297a.c index 9f7e5f59ac82..016b918329ad 100644 --- a/sound/oss/swarm_cs4297a.c +++ b/sound/oss/swarm_cs4297a.c | |||
@@ -616,25 +616,23 @@ static int init_serdma(serdma_t *dma) | |||
616 | 616 | ||
617 | /* Descriptors */ | 617 | /* Descriptors */ |
618 | dma->ringsz = DMA_DESCR; | 618 | dma->ringsz = DMA_DESCR; |
619 | dma->descrtab = kmalloc(dma->ringsz * sizeof(serdma_descr_t), GFP_KERNEL); | 619 | dma->descrtab = kzalloc(dma->ringsz * sizeof(serdma_descr_t), GFP_KERNEL); |
620 | if (!dma->descrtab) { | 620 | if (!dma->descrtab) { |
621 | printk(KERN_ERR "cs4297a: kmalloc descrtab failed\n"); | 621 | printk(KERN_ERR "cs4297a: kzalloc descrtab failed\n"); |
622 | return -1; | 622 | return -1; |
623 | } | 623 | } |
624 | memset(dma->descrtab, 0, dma->ringsz * sizeof(serdma_descr_t)); | ||
625 | dma->descrtab_end = dma->descrtab + dma->ringsz; | 624 | dma->descrtab_end = dma->descrtab + dma->ringsz; |
626 | /* XXX bloddy mess, use proper DMA API here ... */ | 625 | /* XXX bloddy mess, use proper DMA API here ... */ |
627 | dma->descrtab_phys = CPHYSADDR((long)dma->descrtab); | 626 | dma->descrtab_phys = CPHYSADDR((long)dma->descrtab); |
628 | dma->descr_add = dma->descr_rem = dma->descrtab; | 627 | dma->descr_add = dma->descr_rem = dma->descrtab; |
629 | 628 | ||
630 | /* Frame buffer area */ | 629 | /* Frame buffer area */ |
631 | dma->dma_buf = kmalloc(DMA_BUF_SIZE, GFP_KERNEL); | 630 | dma->dma_buf = kzalloc(DMA_BUF_SIZE, GFP_KERNEL); |
632 | if (!dma->dma_buf) { | 631 | if (!dma->dma_buf) { |
633 | printk(KERN_ERR "cs4297a: kmalloc dma_buf failed\n"); | 632 | printk(KERN_ERR "cs4297a: kzalloc dma_buf failed\n"); |
634 | kfree(dma->descrtab); | 633 | kfree(dma->descrtab); |
635 | return -1; | 634 | return -1; |
636 | } | 635 | } |
637 | memset(dma->dma_buf, 0, DMA_BUF_SIZE); | ||
638 | dma->dma_buf_phys = CPHYSADDR((long)dma->dma_buf); | 636 | dma->dma_buf_phys = CPHYSADDR((long)dma->dma_buf); |
639 | 637 | ||
640 | /* Samples buffer area */ | 638 | /* Samples buffer area */ |
@@ -2619,12 +2617,11 @@ static int __init cs4297a_init(void) | |||
2619 | udelay(100); | 2617 | udelay(100); |
2620 | #endif | 2618 | #endif |
2621 | 2619 | ||
2622 | if (!(s = kmalloc(sizeof(struct cs4297a_state), GFP_KERNEL))) { | 2620 | if (!(s = kzalloc(sizeof(struct cs4297a_state), GFP_KERNEL))) { |
2623 | CS_DBGOUT(CS_ERROR, 1, printk(KERN_ERR | 2621 | CS_DBGOUT(CS_ERROR, 1, printk(KERN_ERR |
2624 | "cs4297a: probe() no memory for state struct.\n")); | 2622 | "cs4297a: probe() no memory for state struct.\n")); |
2625 | return -1; | 2623 | return -1; |
2626 | } | 2624 | } |
2627 | memset(s, 0, sizeof(struct cs4297a_state)); | ||
2628 | s->magic = CS4297a_MAGIC; | 2625 | s->magic = CS4297a_MAGIC; |
2629 | init_waitqueue_head(&s->dma_adc.wait); | 2626 | init_waitqueue_head(&s->dma_adc.wait); |
2630 | init_waitqueue_head(&s->dma_dac.wait); | 2627 | init_waitqueue_head(&s->dma_dac.wait); |