From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750961AbbLTVbZ (ORCPT ); Sun, 20 Dec 2015 16:31:25 -0500 Received: from mx2.suse.de ([195.135.220.15]:60554 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750768AbbLTVbZ (ORCPT ); Sun, 20 Dec 2015 16:31:25 -0500 Date: Sun, 20 Dec 2015 22:31:24 +0100 Message-ID: From: Takashi Iwai To: "Nicholas Mc Guire" Cc: "Jaroslav Kysela" , , "Jie Yang" , "Lars-Peter Clausen" , Subject: Re: [PATCH V2] ALSA: oss: consolidate kmalloc/memset 0 call to kzalloc In-Reply-To: <1450534993-8382-1-git-send-email-hofrat@osadl.org> References: <1450534993-8382-1-git-send-email-hofrat@osadl.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/24.5 (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 On Sat, 19 Dec 2015 15:23:13 +0100, Nicholas Mc Guire wrote: > > This is an API consolidation only. The use of kmalloc + memset to 0 > is equivalent to kzalloc. > > Signed-off-by: Nicholas Mc Guire Applied, thanks. Takashi > --- > > V2: somehow managed to insert exactly the same line being removed > so this time actually do the intended kmalloc->kzalloc replacement > > Found by coccinelle script (relaxed version of > scripts/coccinelle/api/alloc/kzalloc-simple.cocci) > > Patch was compile tested with: x86_64_defconfig > CONFIG_SND_PCM_OSS=y > > Patch is against linux-next (localversion-next is -next-20150518) > > diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c > index e557dbe..8cdd06f 100644 > --- a/sound/core/oss/pcm_oss.c > +++ b/sound/core/oss/pcm_oss.c > @@ -851,7 +851,7 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream) > > if (mutex_lock_interruptible(&runtime->oss.params_lock)) > return -EINTR; > - sw_params = kmalloc(sizeof(*sw_params), GFP_KERNEL); > + sw_params = kzalloc(sizeof(*sw_params), GFP_KERNEL); > params = kmalloc(sizeof(*params), GFP_KERNEL); > sparams = kmalloc(sizeof(*sparams), GFP_KERNEL); > if (!sw_params || !params || !sparams) { > @@ -989,7 +989,6 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream) > goto failure; > } > > - memset(sw_params, 0, sizeof(*sw_params)); > if (runtime->oss.trigger) { > sw_params->start_threshold = 1; > } else { > -- > 1.7.10.4 > >