aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Gheorghiu <gheorghiuandru@gmail.com>2013-03-25 09:50:34 -0400
committerTakashi Iwai <tiwai@suse.de>2013-04-02 05:23:00 -0400
commitb8e63df919d75ef4ecafd66b5123a798b18cc0e7 (patch)
treed24a0f34045d1dec15a2f6bc4f43408b6587c38a
parent0d9ffc979f761c091a23020692b3502fa776eac0 (diff)
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: Alexandru Gheorghiu <gheorghiuandru@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/oss/sb_common.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/sound/oss/sb_common.c b/sound/oss/sb_common.c
index 7d42c5418d1b..851a1da46be1 100644
--- a/sound/oss/sb_common.c
+++ b/sound/oss/sb_common.c
@@ -626,13 +626,12 @@ int sb_dsp_detect(struct address_info *hw_config, int pci, int pciio, struct sb_
626 */ 626 */
627 627
628 628
629 detected_devc = kmalloc(sizeof(sb_devc), GFP_KERNEL); 629 detected_devc = kmemdup(devc, sizeof(sb_devc), GFP_KERNEL);
630 if (detected_devc == NULL) 630 if (detected_devc == NULL)
631 { 631 {
632 printk(KERN_ERR "sb: Can't allocate memory for device information\n"); 632 printk(KERN_ERR "sb: Can't allocate memory for device information\n");
633 return 0; 633 return 0;
634 } 634 }
635 memcpy(detected_devc, devc, sizeof(sb_devc));
636 MDB(printk(KERN_INFO "SB %d.%02d detected OK (%x)\n", devc->major, devc->minor, hw_config->io_base)); 635 MDB(printk(KERN_INFO "SB %d.%02d detected OK (%x)\n", devc->major, devc->minor, hw_config->io_base));
637 return 1; 636 return 1;
638} 637}