summaryrefslogtreecommitdiffstats
path: root/sound/oss/uart401.c
diff options
context:
space:
mode:
authorAlexandru Gheorghiu <gheorghiuandru@gmail.com>2013-03-25 15:46:49 +0200
committerTakashi Iwai <tiwai@suse.de>2013-04-02 11:22:52 +0200
commit0d9ffc979f761c091a23020692b3502fa776eac0 (patch)
treeceefe9779d4e7cccdc9d156cc092d3996321f0db /sound/oss/uart401.c
parent4abdbd1c2c1832e7270e546307ffb3e56b286db2 (diff)
downloadlinux-0d9ffc979f761c091a23020692b3502fa776eac0.tar.gz
linux-0d9ffc979f761c091a23020692b3502fa776eac0.tar.bz2
linux-0d9ffc979f761c091a23020692b3502fa776eac0.zip
sound: oss: uart401: 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>
Diffstat (limited to 'sound/oss/uart401.c')
-rw-r--r--sound/oss/uart401.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sound/oss/uart401.c b/sound/oss/uart401.c
index 8e514a676a0d..5433c6f5eca2 100644
--- a/sound/oss/uart401.c
+++ b/sound/oss/uart401.c
@@ -352,23 +352,26 @@ int probe_uart401(struct address_info *hw_config, struct module *owner)
goto cleanup_irq;
}
conf_printf(name, hw_config);
- midi_devs[devc->my_dev] = kmalloc(sizeof(struct midi_operations), GFP_KERNEL);
+ midi_devs[devc->my_dev] = kmemdup(&uart401_operations,
+ sizeof(struct midi_operations),
+ GFP_KERNEL);
if (!midi_devs[devc->my_dev]) {
printk(KERN_ERR "uart401: Failed to allocate memory\n");
goto cleanup_unload_mididev;
}
- memcpy(midi_devs[devc->my_dev], &uart401_operations, sizeof(struct midi_operations));
if (owner)
midi_devs[devc->my_dev]->owner = owner;
midi_devs[devc->my_dev]->devc = devc;
- midi_devs[devc->my_dev]->converter = kmalloc(sizeof(struct synth_operations), GFP_KERNEL);
+ midi_devs[devc->my_dev]->converter = kmemdup(&std_midi_synth,
+ sizeof(struct synth_operations),
+ GFP_KERNEL);
+
if (!midi_devs[devc->my_dev]->converter) {
printk(KERN_WARNING "uart401: Failed to allocate memory\n");
goto cleanup_midi_devs;
}
- memcpy(midi_devs[devc->my_dev]->converter, &std_midi_synth, sizeof(struct synth_operations));
strcpy(midi_devs[devc->my_dev]->info.name, name);
midi_devs[devc->my_dev]->converter->id = "UART401";
midi_devs[devc->my_dev]->converter->midi_dev = devc->my_dev;