ALSA: oss: consolidate kmalloc/memset 0 call to kzalloc
PATCH 1/1 ALSA: oss: consolidate kmalloc/memset 0 call to kzalloc
This is an API consolidation only. The use of kmalloc + memset to 0 is equivalent to kzalloc.
---
Found by coccinelle script (relaxed version of scripts/coccinelle/api/alloc/kzalloc-simple.cocci)
Patch was compile tested with: x86_64_defconfigCONFIG_SND_PCM_OSS=y
Patch is against linux-next (localversion-next is -next-20150518)
sound/core/oss/pcm_oss.c +1 -2
@@ -850,7 +850,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 =kmalloc (sizeof (*sw_params),GFP_KERNEL ); params =kmalloc (sizeof (*params),GFP_KERNEL ); sparams =kmalloc (sizeof (*sparams),GFP_KERNEL );if (!sw_params || !params || !sparams) {
@@ -988,7 +988,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 {
Signature · 1 line
1.7.10.4
Quoted 19 lines · On Fri, 18 Dec 2015 21:01:57 +0100 Nicholas Mc Guire <[email protected]> wrote:
This is an API consolidation only. The use of kmalloc + memset to 0 is equivalent to kzalloc.
Signed-off-by Nicholas Mc Guire <[email protected]>---
Found by coccinelle script (relaxed version of
scripts/coccinelle/api/alloc/kzalloc-simple.cocci)Patch was compile tested with:
x86_64_defconfigCONFIG_SND_PCM_OSS=yPatch is against linux-next (localversion-next is -next-20150518)
sound/core/oss/pcm_oss.c +0
-0
sound/core/oss/pcm_oss.c static int snd_pcm_oss_change_params(struct · line 853
Quoted 5 lines
sound/core/oss/pcm_oss.c +1
-1@@ -850,7 +850,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 =kmalloc (sizeof (*sw_params),GFP_KERNEL );
^
Something odd (manual edit?) seems to have happened to this hunk, making it a no-op. I presume that 'm' was supposed to be a 'z'.
Quoted 11 lines
sound/core/oss/pcm_oss.c +0
-1params =kmalloc (sizeof (*params),GFP_KERNEL ); sparams =kmalloc (sizeof (*sparams),GFP_KERNEL );if (!sw_params || !params || !sparams) {@@ -988,7 +988,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 {