lkml.org 
[lkml]   [2006]   [Jul]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] sound: Conversions from kmalloc+memset to k(z|c)alloc.
Panagiotis Issaris wrote:
> diff --git a/sound/oss/swarm_cs4297a.c b/sound/oss/swarm_cs4297a.c
> index eb5ea32..b257f20 100644
> --- a/sound/oss/swarm_cs4297a.c
> +++ b/sound/oss/swarm_cs4297a.c
> @@ -615,25 +615,23 @@ static int init_serdma(serdma_t *dma)
>
> /* Descriptors */
> dma->ringsz = DMA_DESCR;
> - dma->descrtab = kmalloc(dma->ringsz * sizeof(serdma_descr_t), GFP_KERNEL);
> + dma->descrtab = kcalloc(dma->ringsz, sizeof(serdma_descr_t), GFP_KERNEL);
> if (!dma->descrtab) {
> printk(KERN_ERR "cs4297a: kmalloc descrtab failed\n");

Maybe change the error message as well?

> return -1;
> }
> - memset(dma->descrtab, 0, dma->ringsz * sizeof(serdma_descr_t));
> dma->descrtab_end = dma->descrtab + dma->ringsz;
> /* XXX bloddy mess, use proper DMA API here ... */
> dma->descrtab_phys = CPHYSADDR((long)dma->descrtab);
> dma->descr_add = dma->descr_rem = dma->descrtab;
>
> /* Frame buffer area */
> - dma->dma_buf = kmalloc(DMA_BUF_SIZE, GFP_KERNEL);
> + dma->dma_buf = kzalloc(DMA_BUF_SIZE, GFP_KERNEL);
> if (!dma->dma_buf) {
> printk(KERN_ERR "cs4297a: kmalloc dma_buf failed\n");

here too

> kfree(dma->descrtab);
> return -1;
> }
> - memset(dma->dma_buf, 0, DMA_BUF_SIZE);
> dma->dma_buf_phys = CPHYSADDR((long)dma->dma_buf);
>
> /* Samples buffer area */


Daniel K.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-07-19 04:23    [W:0.046 / U:1.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site