public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Daniel K." <daniel@cluded.net>
To: Panagiotis Issaris <takis@lumumba.uhasselt.be>
Cc: linux-kernel@vger.kernel.org, kyle@parisc-linux.org,
	twoller@crystal.cirrus.com, James@superbug.demon.co.uk,
	zab@zabbo.net, sailer@ife.ee.ethz.ch, perex@suse.cz,
	zaitcev@yahoo.com
Subject: Re: [PATCH] sound: Conversions from kmalloc+memset to k(z|c)alloc.
Date: Wed, 19 Jul 2006 02:15:37 +0000	[thread overview]
Message-ID: <44BD95C9.8050600@cluded.net> (raw)
In-Reply-To: <20060719005455.GB30823@lumumba.uhasselt.be>

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.


  reply	other threads:[~2006-07-19  2:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-19  0:54 [PATCH] sound: Conversions from kmalloc+memset to k(z|c)alloc Panagiotis Issaris
2006-07-19  2:15 ` Daniel K. [this message]
2006-07-19  2:48 ` Pete Zaitcev
2006-07-19  8:39   ` Pekka Enberg
2006-07-20 17:28   ` Panagiotis Issaris
2006-07-19  6:15 ` Muli Ben-Yehuda
2006-07-19 23:58 ` Kyle McMartin
  -- strict thread matches above, loose matches on Subject: below --
2006-07-20 18:46 Panagiotis Issaris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44BD95C9.8050600@cluded.net \
    --to=daniel@cluded.net \
    --cc=James@superbug.demon.co.uk \
    --cc=kyle@parisc-linux.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@suse.cz \
    --cc=sailer@ife.ee.ethz.ch \
    --cc=takis@lumumba.uhasselt.be \
    --cc=twoller@crystal.cirrus.com \
    --cc=zab@zabbo.net \
    --cc=zaitcev@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox