Handle the error code returned by cyclic_register() and propagate it.
Signed-off-by: Marek Vasut <[email protected]>
---
Cc: Aaron Williams <[email protected]>
Cc: Anatolij Gustschin <[email protected]>
Cc: Angelo Dureghello <[email protected]>
Cc: Christian Marangi <[email protected]>
Cc: Devarsh Thakkar <[email protected]>
Cc: Heinrich Schuchardt <[email protected]>
Cc: Jaehoon Chung <[email protected]>
Cc: Michael Polyntsov <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Nikhil M Jain <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Peter Robinson <[email protected]>
Cc: Rasmus Villemoes <[email protected]>
Cc: Ronald Wahl <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Stefan Roese <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
---
drivers/led/led_sw_blink.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/led/led_sw_blink.c b/drivers/led/led_sw_blink.c
index ee1546d02d4..859dac47c30 100644
--- a/drivers/led/led_sw_blink.c
+++ b/drivers/led/led_sw_blink.c
@@ -50,6 +50,7 @@ int led_sw_set_period(struct udevice *dev, int period_ms)
struct led_sw_blink *sw_blink = uc_plat->sw_blink;
struct led_ops *ops = led_get_ops(dev);
int half_period_us;
+ int ret = 0;
half_period_us = period_ms * 1000 / 2;
@@ -71,8 +72,8 @@ int led_sw_set_period(struct udevice *dev, int period_ms)
}
if (sw_blink->state == LED_SW_BLINK_ST_DISABLED) {
- cyclic_register(&sw_blink->cyclic, led_sw_blink,
- half_period_us, sw_blink->cyclic_name);
+ ret = cyclic_register(&sw_blink->cyclic, led_sw_blink,
+ half_period_us, sw_blink->cyclic_name);
} else {
sw_blink->cyclic.delay_us = half_period_us;
sw_blink->cyclic.start_time_us = timer_get_us();
@@ -81,7 +82,7 @@ int led_sw_set_period(struct udevice *dev, int period_ms)
sw_blink->state = LED_SW_BLINK_ST_NOT_READY;
ops->set_state(dev, LEDST_OFF);
- return 0;
+ return ret;
}
bool led_sw_is_blinking(struct udevice *dev)
--
2.45.2