Skip to content

Commit

Permalink
sound: oss: sb_common: Used kmemdup instead of kmalloc and memcpy
Browse files Browse the repository at this point in the history
Used kmemdup instead of replicating it's behaviour with kmalloc followed
by memcpy.
Patch found using coccinelle.

Signed-off-by: Alexandru Gheorghiu <gheorghiuandru@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Alexandru Gheorghiu authored and Takashi Iwai committed Apr 2, 2013
1 parent 0d9ffc9 commit b8e63df
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions sound/oss/sb_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -626,13 +626,12 @@ int sb_dsp_detect(struct address_info *hw_config, int pci, int pciio, struct sb_
*/


detected_devc = kmalloc(sizeof(sb_devc), GFP_KERNEL);
detected_devc = kmemdup(devc, sizeof(sb_devc), GFP_KERNEL);
if (detected_devc == NULL)
{
printk(KERN_ERR "sb: Can't allocate memory for device information\n");
return 0;
}
memcpy(detected_devc, devc, sizeof(sb_devc));
MDB(printk(KERN_INFO "SB %d.%02d detected OK (%x)\n", devc->major, devc->minor, hw_config->io_base));
return 1;
}
Expand Down

0 comments on commit b8e63df

Please sign in to comment.