Skip to content

Commit

Permalink
Staging: speakup: Use kmemdup rather than duplicating its implementation
Browse files Browse the repository at this point in the history
Use kmemdup rather than duplicating its implementation

The semantic patch that makes this change is available
in scripts/coccinelle/api/memdup.cocci.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Thomas Meyer authored and Greg Kroah-Hartman committed Nov 27, 2011
1 parent cd42076 commit 1aa5eb6
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/staging/speakup/kobjects.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,11 @@ static ssize_t keymap_store(struct kobject *kobj, struct kobj_attribute *attr,
unsigned long flags;

spk_lock(flags);
in_buff = kmalloc(count + 1, GFP_ATOMIC);
in_buff = kmemdup(buf, count + 1, GFP_ATOMIC);
if (!in_buff) {
spk_unlock(flags);
return -ENOMEM;
}
memcpy(in_buff, buf, count + 1);
if (strchr("dDrR", *in_buff)) {
set_key_info(key_defaults, key_buf);
pr_info("keymap set to default values\n");
Expand Down

0 comments on commit 1aa5eb6

Please sign in to comment.