[PATCH 3/5] led: triggers: fix crash on disabling "default-on" trigger

Antony Pavlov antonynpavlov at gmail.com
Wed Jul 30 10:34:34 PDT 2014


Here is a sample crash log on Ritmix RZX-50:

    barebox:/ trigger
    0: panic
    1: heartbeat
    2: net rx
    3: net tx
    4: net
    5: default on (led 0)
    barebox:/ trigger -d 5
    ...
    Ooops, TLB miss on store!

Signed-off-by: Antony Pavlov <antonynpavlov at gmail.com>
---
 drivers/led/led-triggers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/led/led-triggers.c b/drivers/led/led-triggers.c
index 5eaf732..1a5a09f 100644
--- a/drivers/led/led-triggers.c
+++ b/drivers/led/led-triggers.c
@@ -124,7 +124,7 @@ int led_set_trigger(enum led_trigger trigger, struct led *led)
 
 	triggers[trigger].led = led;
 
-	if (trigger == LED_TRIGGER_DEFAULT_ON)
+	if (led && trigger == LED_TRIGGER_DEFAULT_ON)
 		led_set(triggers[trigger].led, triggers[trigger].led->max_value);
 
 	return 0;
-- 
2.0.1




More information about the barebox mailing list