OSDN Git Service

gpiolib: use kstrdup_const() for gpio_device label
authorBartosz Golaszewski <brgl@bgdev.pl>
Thu, 14 Dec 2017 14:29:20 +0000 (15:29 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 20 Dec 2017 08:16:39 +0000 (09:16 +0100)
commitfcf273e5807976009dbb5ffb00bd5b9091843fe6
treebf5d05ee0bbd17904fc7efa59cfe45068e914df6
parent3b469b0a139e65a7c3da32f5481467f6bdcee837
gpiolib: use kstrdup_const() for gpio_device label

Users often pass a pointer to a static string to gpiochip_add_data()
family of functions. Avoid unnecessary memory allocations with the
provided helper routine.

While at it: use a ternary operator instead of an if else for brevity.

Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpiolib.c