From: Florian Eckert Date: Thu, 1 Feb 2024 10:31:20 +0000 (+0100) Subject: base-files/leds: merging code sequences that belongs together X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=3aa812d8bebdb40316d1d57150c766234f5245dd;p=openwrt%2Fstaging%2Fnbd.git 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 --- 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