summaryrefslogtreecommitdiffstats
path: root/drivers/led
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2015-07-06 12:54:33 -0600
committerSimon Glass <sjg@chromium.org>2015-07-21 17:39:32 -0600
commitfb8a5ffc77597a99678dbd5077f29ec9df54bdbe (patch)
tree2c8c1b149b87b289471269fe3b8624484c2d839e /drivers/led
parent8e6cc46178f9eecada860f7a8f14672e6a94c2de (diff)
downloadblackbird-obmc-uboot-fb8a5ffc77597a99678dbd5077f29ec9df54bdbe.tar.gz
blackbird-obmc-uboot-fb8a5ffc77597a99678dbd5077f29ec9df54bdbe.zip
led: Return -ENODEV if the LED device cannot be found
We normally use -ENODEV for a missing device, rather than -ENOENT. The latter is reserved for when we have a device but cannot find something within it. Also avoid looking at the root LED device since it is only a container. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/led')
-rw-r--r--drivers/led/led-uclass.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/led/led-uclass.c b/drivers/led/led-uclass.c
index a80ae93d45..784ac870e2 100644
--- a/drivers/led/led-uclass.c
+++ b/drivers/led/led-uclass.c
@@ -24,11 +24,12 @@ int led_get_by_label(const char *label, struct udevice **devp)
uclass_foreach_dev(dev, uc) {
struct led_uclass_plat *uc_plat = dev_get_uclass_platdata(dev);
- if (!strcmp(label, uc_plat->label))
+ /* Ignore the top-level LED node */
+ if (uc_plat->label && !strcmp(label, uc_plat->label))
return uclass_get_device_tail(dev, 0, devp);
}
- return -ENOENT;
+ return -ENODEV;
}
int led_set_on(struct udevice *dev, int on)
OpenPOWER on IntegriCloud