* [PATCH] usbusx2yaudio: kfree(NULL) is valid
@ 2007-05-12 18:29 Richard Knutsson
2007-05-14 9:33 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Richard Knutsson @ 2007-05-12 18:29 UTC (permalink / raw)
To: Takashi Iwai; +Cc: linux-kernel, Richard Knutsson
if (!x) kfree(x); is not needed since kfree(NULL) is valid.
Signed-off-by: Richard Knutsson <ricknu-0@student.ltu.se>
---
Compile-tested with all(yes|mod|no)config on x86(|_64) & sparc(|64)
Diffed against Linus' git-tree.
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;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] usbusx2yaudio: kfree(NULL) is valid
2007-05-12 18:29 [PATCH] usbusx2yaudio: kfree(NULL) is valid Richard Knutsson
@ 2007-05-14 9:33 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2007-05-14 9:33 UTC (permalink / raw)
To: Richard Knutsson; +Cc: linux-kernel
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 <ricknu-0@student.ltu.se>
> ---
> 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;
> }
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-05-14 9:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-12 18:29 [PATCH] usbusx2yaudio: kfree(NULL) is valid Richard Knutsson
2007-05-14 9:33 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome