mtd: pmcmsp: use kstrndup instead of kmalloc+strncpy
commit12b730b23a829f349a85245458e1147b47d74a22
authorArnd Bergmann <arnd@arndb.de>
Fri, 3 Feb 2017 09:49:17 +0000 (3 10:49 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 18 Apr 2017 05:55:50 +0000 (18 07:55 +0200)
treea73c178321ef3baf31dec77c0ccc12aca45bf7a3
parentc7063673fe4bfc5a270afd15cd77c0c917e9502c
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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mtd/maps/pmcmsp-flash.c