Commit b8e63df9 authored by Alexandru Gheorghiu's avatar Alexandru Gheorghiu Committed by Takashi Iwai

sound: oss: sb_common: Used kmemdup instead of kmalloc and memcpy

Used kmemdup instead of replicating it's behaviour with kmalloc followed
by memcpy.
Patch found using coccinelle.
Signed-off-by: default avatarAlexandru Gheorghiu <gheorghiuandru@gmail.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 0d9ffc97
...@@ -626,13 +626,12 @@ int sb_dsp_detect(struct address_info *hw_config, int pci, int pciio, struct sb_ ...@@ -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) if (detected_devc == NULL)
{ {
printk(KERN_ERR "sb: Can't allocate memory for device information\n"); printk(KERN_ERR "sb: Can't allocate memory for device information\n");
return 0; 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)); MDB(printk(KERN_INFO "SB %d.%02d detected OK (%x)\n", devc->major, devc->minor, hw_config->io_base));
return 1; return 1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment