From 3aa812d8bebdb40316d1d57150c766234f5245dd Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Thu, 1 Feb 2024 11:31:20 +0100 Subject: [PATCH] base-files/leds: merging code sequences that belongs together Setting the trigger and checking whether the trigger can be set belong together and should not be interrupted by other lines of code. Signed-off-by: Florian Eckert --- package/base-files/files/etc/init.d/led | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/package/base-files/files/etc/init.d/led b/package/base-files/files/etc/init.d/led index d7fee9ebb2..4d3feddf64 100755 --- a/package/base-files/files/etc/init.d/led +++ b/package/base-files/files/etc/init.d/led @@ -65,12 +65,11 @@ load_led() { [ "$default" = 0 ] && echo 0 >/sys/class/leds/${sysfs}/brightness - echo $trigger > /sys/class/leds/${sysfs}/trigger 2> /dev/null - ret="$?" - [ $default = 1 ] && cat /sys/class/leds/${sysfs}/max_brightness > /sys/class/leds/${sysfs}/brightness + echo $trigger > /sys/class/leds/${sysfs}/trigger 2> /dev/null + ret="$?" [ $ret = 0 ] || { echo >&2 "Skipping trigger '$trigger' for led '$name' due to missing kernel module" return 1 -- 2.30.2