[1/6] ALSA: PCM: Remove redundant null check before kfree

Message ID 1353488819-13902-1-git-send-email-sachin.kamat@linaro.org
State Accepted
Headers show

Commit Message

Sachin Kamat Nov. 21, 2012, 9:06 a.m.
kfree on a null pointer is a no-op.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
Build tested and based on linux-next 20121115.
---
 sound/core/pcm.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

Comments

Takashi Iwai Nov. 21, 2012, 9:44 a.m. | #1
At Wed, 21 Nov 2012 14:36:54 +0530,
Sachin Kamat wrote:
> 
> kfree on a null pointer is a no-op.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>

Thanks, applied.


Takashi

> ---
> Build tested and based on linux-next 20121115.
> ---
>  sound/core/pcm.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/core/pcm.c b/sound/core/pcm.c
> index 030102c..61798f8 100644
> --- a/sound/core/pcm.c
> +++ b/sound/core/pcm.c
> @@ -981,8 +981,7 @@ void snd_pcm_detach_substream(struct snd_pcm_substream *substream)
>  		       PAGE_ALIGN(sizeof(struct snd_pcm_mmap_control)));
>  	kfree(runtime->hw_constraints.rules);
>  #ifdef CONFIG_SND_PCM_XRUN_DEBUG
> -	if (runtime->hwptr_log)
> -		kfree(runtime->hwptr_log);
> +	kfree(runtime->hwptr_log);
>  #endif
>  	kfree(runtime);
>  	substream->runtime = NULL;
> -- 
> 1.7.4.1
>

Patch

diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index 030102c..61798f8 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -981,8 +981,7 @@  void snd_pcm_detach_substream(struct snd_pcm_substream *substream)
 		       PAGE_ALIGN(sizeof(struct snd_pcm_mmap_control)));
 	kfree(runtime->hw_constraints.rules);
 #ifdef CONFIG_SND_PCM_XRUN_DEBUG
-	if (runtime->hwptr_log)
-		kfree(runtime->hwptr_log);
+	kfree(runtime->hwptr_log);
 #endif
 	kfree(runtime);
 	substream->runtime = NULL;