Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ALSA: seq: oss: use kzalloc

Use kzalloc instead of kmalloc + memset.

The semantic patch that makes this change is:
(https://coccinelle.gitlabpages.inria.fr/website/)

//<smpl>
@@
expression res, size, flag;
@@
- res = kmalloc(size, flag);
+ res = kzalloc(size, flag);
...
- memset(res, 0, size);
//</smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>

Link: https://lore.kernel.org/r/20220312102705.71413-4-Julia.Lawall@inria.fr
Signed-off-by: Takashi Iwai <tiwai@suse.de>

authored by

Julia Lawall and committed by
Takashi Iwai
3baa40d4 327e8ba5

+1 -2
+1 -2
sound/core/seq/oss/seq_oss_init.c
··· 66 66 struct snd_seq_port_info *port; 67 67 struct snd_seq_port_callback port_callback; 68 68 69 - port = kmalloc(sizeof(*port), GFP_KERNEL); 69 + port = kzalloc(sizeof(*port), GFP_KERNEL); 70 70 if (!port) { 71 71 rc = -ENOMEM; 72 72 goto __error; ··· 81 81 system_client = rc; 82 82 83 83 /* create annoucement receiver port */ 84 - memset(port, 0, sizeof(*port)); 85 84 strcpy(port->name, "Receiver"); 86 85 port->addr.client = system_client; 87 86 port->capability = SNDRV_SEQ_PORT_CAP_WRITE; /* receive only */