mirror of https://gitee.com/openkylin/linux.git
mtd: phram: replace kmalloc/strcpy by kstrdup
Cc: Joern Engel <joern@lazybastard.org> Signed-off-by: Fabian Frederick <fabf@skynet.be> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
This commit is contained in:
parent
1360246a4f
commit
89384f6462
|
@ -181,12 +181,10 @@ static int parse_name(char **pname, const char *token)
|
|||
if (len > 64)
|
||||
return -ENOSPC;
|
||||
|
||||
name = kmalloc(len, GFP_KERNEL);
|
||||
name = kstrdup(token, GFP_KERNEL);
|
||||
if (!name)
|
||||
return -ENOMEM;
|
||||
|
||||
strcpy(name, token);
|
||||
|
||||
*pname = name;
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue