If a gpiochip sets it's gpio_chip->names, it must give every gpio a unique name. However we may not need to name all gpios, for example if they are unused. gpio-line-names allows this by ignoring gpios with empty names. But gpiochip_set_desc_names() will yell at us, as the empty name will collide with other empty names. Fix this by skipping empty strings, so that they look like unnamed gpios. Signed-off-by: Brandon Maier <brandon.maier@xxxxxxxxxxxxxxxxxxx> --- drivers/gpio/gpiolib-devprop.c | 3 ++- drivers/gpio/gpiolib.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpiolib-devprop.c b/drivers/gpio/gpiolib-devprop.c index dd517098ab95..2c56a0acd98b 100644 --- a/drivers/gpio/gpiolib-devprop.c +++ b/drivers/gpio/gpiolib-devprop.c @@ -52,7 +52,8 @@ void devprop_gpiochip_set_names(struct gpio_chip *chip, } for (i = 0; i < count; i++) - gdev->descs[i].name = names[i]; + if (names[i] && names[i][0]) + gdev->descs[i].name = names[i]; kfree(names); } diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 86c147b3f4af..7d359e560d81 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -341,7 +341,8 @@ static int gpiochip_set_desc_names(struct gpio_chip *gc) /* Then add all names to the GPIO descriptors */ for (i = 0; i != gc->ngpio; ++i) - gdev->descs[i].name = gc->names[i]; + if (gc->names[i] && gc->names[i][0]) + gdev->descs[i].name = gc->names[i]; return 0; } -- 2.19.0