From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753833Ab0EQGPN (ORCPT ); Mon, 17 May 2010 02:15:13 -0400 Received: from cantor2.suse.de ([195.135.220.15]:45920 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753276Ab0EQGPL (ORCPT ); Mon, 17 May 2010 02:15:11 -0400 Date: Mon, 17 May 2010 08:15:08 +0200 Message-ID: From: Takashi Iwai To: Julia Lawall Cc: Jaroslav Kysela , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH 1/20] sound/pci/asihpi: Use kzalloc In-Reply-To: References: User-Agent: Wanderlust/2.15.6 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.7 Emacs/23.1 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org At Thu, 13 May 2010 21:58:37 +0200 (CEST), Julia Lawall wrote: > > From: Julia Lawall > > Use kzalloc rather than the combination of kmalloc and memset. > > The semantic patch that makes this change is as follows: > (http://coccinelle.lip6.fr/) > > // > @@ > expression x,size,flags; > statement S; > @@ > > -x = kmalloc(size,flags); > +x = kzalloc(size,flags); > if (x == NULL) S > -memset(x, 0, size); > // > > Signed-off-by: Julia Lawall Applied now. Thanks. Takashi > --- > sound/pci/asihpi/hpi6000.c | 3 +-- > sound/pci/asihpi/hpi6205.c | 3 +-- > 2 files changed, 2 insertions(+), 4 deletions(-) > > diff -u -p a/sound/pci/asihpi/hpi6000.c b/sound/pci/asihpi/hpi6000.c > --- a/sound/pci/asihpi/hpi6000.c > +++ b/sound/pci/asihpi/hpi6000.c > @@ -448,14 +448,13 @@ static void subsys_create_adapter(struct > if (phm->u.s.resource.r.pci->device_id != HPI_PCI_DEV_ID_PCI2040) > return; > > - ao.priv = kmalloc(sizeof(struct hpi_hw_obj), GFP_KERNEL); > + ao.priv = kzalloc(sizeof(struct hpi_hw_obj), GFP_KERNEL); > if (!ao.priv) { > HPI_DEBUG_LOG(ERROR, "cant get mem for adapter object\n"); > phr->error = HPI_ERROR_MEMORY_ALLOC; > return; > } > > - memset(ao.priv, 0, sizeof(struct hpi_hw_obj)); > /* create the adapter object based on the resource information */ > /*? memcpy(&ao.Pci,&phm->u.s.Resource.r.Pci,sizeof(ao.Pci)); */ > ao.pci = *phm->u.s.resource.r.pci; > diff -u -p a/sound/pci/asihpi/hpi6205.c b/sound/pci/asihpi/hpi6205.c > --- a/sound/pci/asihpi/hpi6205.c > +++ b/sound/pci/asihpi/hpi6205.c > @@ -482,13 +482,12 @@ static void subsys_create_adapter(struct > if (phm->u.s.resource.r.pci->device_id != HPI_PCI_DEV_ID_DSP6205) > return; > > - ao.priv = kmalloc(sizeof(struct hpi_hw_obj), GFP_KERNEL); > + ao.priv = kzalloc(sizeof(struct hpi_hw_obj), GFP_KERNEL); > if (!ao.priv) { > HPI_DEBUG_LOG(ERROR, "cant get mem for adapter object\n"); > phr->error = HPI_ERROR_MEMORY_ALLOC; > return; > } > - memset(ao.priv, 0, sizeof(struct hpi_hw_obj)); > > ao.pci = *phm->u.s.resource.r.pci; > err = create_adapter_obj(&ao, &os_error_code); >