Skip to content

Commit 67ada83

Browse files
thomasmeytiwai
authored andcommitted
ALSA: asihpi - use kzalloc()
Use kzalloc rather than kmalloc followed by memset with 0 This considers some simple cases that are common and easy to validate Note in particular that there are no ...s in the rule, so all of the matched code has to be contiguous The semantic patch that makes this output is available in scripts/coccinelle/api/alloc/kzalloc-simple.cocci. More information about semantic patching is available at http://coccinelle.lip6.fr/ Signed-off-by: Thomas Meyer <thomas@m3y3r.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent f438948 commit 67ada83

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

‎sound/pci/asihpi/hpicmn.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -631,13 +631,12 @@ struct hpi_control_cache *hpi_alloc_control_cache(const u32 control_count,
631631
if (!p_cache)
632632
return NULL;
633633

634-
p_cache->p_info =
635-
kmalloc(sizeof(*p_cache->p_info) * control_count, GFP_KERNEL);
634+
p_cache->p_info = kzalloc(sizeof(*p_cache->p_info) * control_count,
635+
GFP_KERNEL);
636636
if (!p_cache->p_info) {
637637
kfree(p_cache);
638638
return NULL;
639639
}
640-
memset(p_cache->p_info, 0, sizeof(*p_cache->p_info) * control_count);
641640
p_cache->cache_size_in_bytes = size_in_bytes;
642641
p_cache->control_count = control_count;
643642
p_cache->p_cache = p_dsp_control_buffer;

0 commit comments

Comments
 (0)