]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: fbtft: Use kmemdup rather than duplicating its implementation
authorMadhusudhanan Ravindran <mravindran04@gmail.com>
Sun, 8 Mar 2015 04:56:30 +0000 (10:26 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 20 Mar 2015 12:54:45 +0000 (13:54 +0100)
The semantic patch that makes this change is available
in scriptcoccinelle/api/memdup.cocci.

Signed-off-by: Madhusudhanan Ravindran <mravindran04@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/fbtft/fbtft-sysfs.c

index 45f8de3d11ad45d0b9e49364550e957f23f9d1e2..ba4551fcb9f0a5e2450fd623c2e90c0574daa92c 100644 (file)
@@ -37,10 +37,9 @@ int fbtft_gamma_parse_str(struct fbtft_par *par, unsigned long *curves,
 
        fbtft_par_dbg(DEBUG_SYSFS, par, "%s\n", str);
 
-       tmp = kmalloc(size+1, GFP_KERNEL);
+       tmp = kmemdup(str, size + 1, GFP_KERNEL);
        if (!tmp)
                return -ENOMEM;
-       memcpy(tmp, str, size+1);
 
        /* replace optional separators */
        str_p = tmp;