mtd: pmcmsp: use kstrndup instead of kmalloc+strncpy
authorArnd Bergmann <arnd@arndb.de>
Fri, 3 Feb 2017 09:49:17 +0000 (10:49 +0100)
committerBrian Norris <computersforpeace@gmail.com>
Wed, 8 Feb 2017 21:15:49 +0000 (13:15 -0800)
commit906b268477bc03daaa04f739844c120fe4dbc991
tree9d16d7f62af080523d29a37c585208735e26dc35
parent56ff337ea433731fa5f04cf9901404705bbbb6e0
mtd: pmcmsp: use kstrndup instead of kmalloc+strncpy

kernelci.org reports a warning for this driver, as it copies a local
variable into a 'const char *' string:

    drivers/mtd/maps/pmcmsp-flash.c:149:30: warning: passing argument 1 of 'strncpy' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]

Using kstrndup() simplifies the code and avoids the warning.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
drivers/mtd/maps/pmcmsp-flash.c