mtd: pmcmsp: use kstrndup instead of kmalloc+strncpy
authorArnd Bergmann <arnd@arndb.de>
Fri, 3 Feb 2017 09:49:17 +0000 (10:49 +0100)
committerDanny Wood <danwood76@gmail.com>
Tue, 29 Jan 2019 13:17:32 +0000 (13:17 +0000)
commitaf71332070edcf35c651b2738b4dce56c25350b8
tree027a72436f405eeb56e6fbdadb9b91902f0c37dd
parenta5c3ad108fa29ae4ef7250a66137580b2b25c503
mtd: pmcmsp: use kstrndup instead of kmalloc+strncpy

commit 906b268477bc03daaa04f739844c120fe4dbc991 upstream.

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>
Signed-off-by: Willy Tarreau <w@1wt.eu>
drivers/mtd/maps/pmcmsp-flash.c