From d023a038222db319d5d56b471ba76581fdb3b269 Mon Sep 17 00:00:00 2001 From: Marco Felsch Date: Thu, 18 Oct 2018 12:43:47 +0200 Subject: gpiolib: fix of_hog_gpio gpio label assignment Current the label is retrieved by the line-name property but this is a optional property. In case of a missing line-name property the label is NULL. As the binding documentation told, the gpio-label must be set to the device-node name in case of missing line-name property. Fixes: 37e6bee7e5 ("gpiolib: Add support for GPIO "hog" nodes") Signed-off-by: Marco Felsch Signed-off-by: Sascha Hauer --- drivers/gpio/gpiolib.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'drivers/gpio/gpiolib.c') diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 4e0bf73742..982bec0b69 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -382,7 +382,10 @@ static int of_hog_gpio(struct device_node *np, struct gpio_chip *chip, else return -EINVAL; - of_property_read_string(np, "line-name", &name); + /* The line-name is optional and if not present the node name is used */ + ret = of_property_read_string(np, "line-name", &name); + if (ret < 0) + name = np->name; return gpio_request_one(gpio, flags, name); } -- cgit v1.2.3