diff options
author | Heiner Kallweit <hkallweit1@gmail.com> | 2016-09-14 20:55:18 +0200 |
---|---|---|
committer | Jacek Anaszewski <j.anaszewski@samsung.com> | 2016-09-15 16:49:42 +0200 |
commit | bec69de89bab29c739ab84ceb04ae63d6811babf (patch) | |
tree | ef7f54092b35d682c5d3ff0dcf264507aa42df10 /drivers/leds | |
parent | leds: gpio: simplify gpio_leds_create (diff) | |
download | linux-bec69de89bab29c739ab84ceb04ae63d6811babf.tar.xz linux-bec69de89bab29c739ab84ceb04ae63d6811babf.zip |
leds: gpio: fix and simplify reading property "label"
Checking for the presence of the property first isn't strictly needed
as we can react on the return code of fwnode_property_read_string.
Also, even if the presence of a property "label" was checked,
reading a string value for it theoretically still can fail and
this case isn't handled.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Diffstat (limited to 'drivers/leds')
-rw-r--r-- | drivers/leds/leds-gpio.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c index 171ba2fbb59a..00a24e32c6c6 100644 --- a/drivers/leds/leds-gpio.c +++ b/drivers/leds/leds-gpio.c @@ -181,16 +181,14 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev) goto err; } - if (fwnode_property_present(child, "label")) { - fwnode_property_read_string(child, "label", &led.name); - } else { - if (IS_ENABLED(CONFIG_OF) && !led.name && np) - led.name = np->name; - if (!led.name) { - ret = -EINVAL; - goto err; - } + ret = fwnode_property_read_string(child, "label", &led.name); + if (ret && IS_ENABLED(CONFIG_OF) && np) + led.name = np->name; + if (!led.name) { + ret = -EINVAL; + goto err; } + fwnode_property_read_string(child, "linux,default-trigger", &led.default_trigger); |