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

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>

authored by

Alexandru Gheorghiu and committed by
Takashi Iwai
b8e63df9 0d9ffc97

+1 -2
+1 -2
sound/oss/sb_common.c
··· 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 630 if (detected_devc == NULL) 631 631 { 632 632 printk(KERN_ERR "sb: Can't allocate memory for device information\n"); 633 633 return 0; 634 634 } 635 - memcpy(detected_devc, devc, sizeof(sb_devc)); 636 635 MDB(printk(KERN_INFO "SB %d.%02d detected OK (%x)\n", devc->major, devc->minor, hw_config->io_base)); 637 636 return 1; 638 637 }