led: gpio: Default to using node name if label is absent
authorSean Anderson <seanga2@gmail.com>
Mon, 14 Sep 2020 15:02:02 +0000 (11:02 -0400)
committerTom Rini <trini@konsulko.com>
Thu, 8 Oct 2020 15:42:36 +0000 (11:42 -0400)
This more closely mirrors Linux's behaviour, and will make it easier to
transition to using function+color in the future.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
drivers/led/led_gpio.c

index ef9b61e..2cdb026 100644 (file)
@@ -99,11 +99,8 @@ static int led_gpio_bind(struct udevice *parent)
                const char *label;
 
                label = ofnode_read_string(node, "label");
-               if (!label) {
-                       debug("%s: node %s has no label\n", __func__,
-                             ofnode_get_name(node));
-                       return -EINVAL;
-               }
+               if (!label)
+                       label = ofnode_get_name(node);
                ret = device_bind_driver_to_node(parent, "gpio_led",
                                                 ofnode_get_name(node),
                                                 node, &dev);