From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933877AbXENJeb (ORCPT ); Mon, 14 May 2007 05:34:31 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S933294AbXENJeC (ORCPT ); Mon, 14 May 2007 05:34:02 -0400 Received: from mail.suse.de ([195.135.220.2]:60505 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933278AbXENJeA (ORCPT ); Mon, 14 May 2007 05:34:00 -0400 Date: Mon, 14 May 2007 11:33:58 +0200 Message-ID: From: Takashi Iwai To: Richard Knutsson Cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH] usbusx2yaudio: kfree(NULL) is valid In-Reply-To: <20070512183154.17375.54599.sendpatchset@thinktank.campus.ltu.se> References: <20070512183154.17375.54599.sendpatchset@thinktank.campus.ltu.se> User-Agent: Wanderlust/2.12.0 (Your Wildest Dreams) SEMI/1.14.6 (Maruoka) FLIM/1.14.7 (=?ISO-8859-4?Q?Sanj=F2?=) APEL/10.6 MULE XEmacs/21.5 (beta27) (fiddleheads) (+CVS-20060704) (i386-suse-linux) 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 X-Mailing-List: linux-kernel@vger.kernel.org At Sat, 12 May 2007 20:29:20 +0200 (MEST), Richard Knutsson wrote: > > if (!x) kfree(x); is not needed since kfree(NULL) is valid. > > Signed-off-by: Richard Knutsson > --- > Compile-tested with all(yes|mod|no)config on x86(|_64) & sparc(|64) > Diffed against Linus' git-tree. Thanks, merged to ALSA tree now. Takashi > > > diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c > index 0a352e4..48e9aa3 100644 > --- a/sound/usb/usx2y/usbusx2yaudio.c > +++ b/sound/usb/usx2y/usbusx2yaudio.c > @@ -935,10 +935,9 @@ static struct snd_pcm_ops snd_usX2Y_pcm_ops = > */ > static void usX2Y_audio_stream_free(struct snd_usX2Y_substream **usX2Y_substream) > { > - if (NULL != usX2Y_substream[SNDRV_PCM_STREAM_PLAYBACK]) { > - kfree(usX2Y_substream[SNDRV_PCM_STREAM_PLAYBACK]); > - usX2Y_substream[SNDRV_PCM_STREAM_PLAYBACK] = NULL; > - } > + kfree(usX2Y_substream[SNDRV_PCM_STREAM_PLAYBACK]); > + usX2Y_substream[SNDRV_PCM_STREAM_PLAYBACK] = NULL; > + > kfree(usX2Y_substream[SNDRV_PCM_STREAM_CAPTURE]); > usX2Y_substream[SNDRV_PCM_STREAM_CAPTURE] = NULL; > } >