aboutsummaryrefslogtreecommitdiffstats
path: root/sound/oss
diff options
context:
space:
mode:
authorAlexandru Gheorghiu <gheorghiuandru@gmail.com>2013-03-25 09:46:49 -0400
committerTakashi Iwai <tiwai@suse.de>2013-04-02 05:22:52 -0400
commit0d9ffc979f761c091a23020692b3502fa776eac0 (patch)
treeceefe9779d4e7cccdc9d156cc092d3996321f0db /sound/oss
parent4abdbd1c2c1832e7270e546307ffb3e56b286db2 (diff)
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')
-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)
352 goto cleanup_irq; 352 goto cleanup_irq;
353 } 353 }
354 conf_printf(name, hw_config); 354 conf_printf(name, hw_config);
355 midi_devs[devc->my_dev] = kmalloc(sizeof(struct midi_operations), GFP_KERNEL); 355 midi_devs[devc->my_dev] = kmemdup(&uart401_operations,
356 sizeof(struct midi_operations),
357 GFP_KERNEL);
356 if (!midi_devs[devc->my_dev]) { 358 if (!midi_devs[devc->my_dev]) {
357 printk(KERN_ERR "uart401: Failed to allocate memory\n"); 359 printk(KERN_ERR "uart401: Failed to allocate memory\n");
358 goto cleanup_unload_mididev; 360 goto cleanup_unload_mididev;
359 } 361 }
360 memcpy(midi_devs[devc->my_dev], &uart401_operations, sizeof(struct midi_operations));
361 362
362 if (owner) 363 if (owner)
363 midi_devs[devc->my_dev]->owner = owner; 364 midi_devs[devc->my_dev]->owner = owner;
364 365
365 midi_devs[devc->my_dev]->devc = devc; 366 midi_devs[devc->my_dev]->devc = devc;
366 midi_devs[devc->my_dev]->converter = kmalloc(sizeof(struct synth_operations), GFP_KERNEL); 367 midi_devs[devc->my_dev]->converter = kmemdup(&std_midi_synth,
368 sizeof(struct synth_operations),
369 GFP_KERNEL);
370
367 if (!midi_devs[devc->my_dev]->converter) { 371 if (!midi_devs[devc->my_dev]->converter) {
368 printk(KERN_WARNING "uart401: Failed to allocate memory\n"); 372 printk(KERN_WARNING "uart401: Failed to allocate memory\n");
369 goto cleanup_midi_devs; 373 goto cleanup_midi_devs;
370 } 374 }
371 memcpy(midi_devs[devc->my_dev]->converter, &std_midi_synth, sizeof(struct synth_operations));
372 strcpy(midi_devs[devc->my_dev]->info.name, name); 375 strcpy(midi_devs[devc->my_dev]->info.name, name);
373 midi_devs[devc->my_dev]->converter->id = "UART401"; 376 midi_devs[devc->my_dev]->converter->id = "UART401";
374 midi_devs[devc->my_dev]->converter->midi_dev = devc->my_dev; 377 midi_devs[devc->my_dev]->converter->midi_dev = devc->my_dev;