]> git.karo-electronics.de Git - linux-beck.git/commitdiff
leds: Don't allow brightness values greater than max_brightness
authorGabriele Mazzotta <gabriele.mzt@gmail.com>
Tue, 23 Dec 2014 18:59:23 +0000 (10:59 -0800)
committerBryan Wu <cooloney@gmail.com>
Wed, 14 Jan 2015 18:40:19 +0000 (10:40 -0800)
Since commit 4d71a4a12b13 ("leds: Add support for setting brightness in
a synchronous way") the value passed to brightness_set() is no longer
limited to max_brightness and can be different from the internally saved
brightness value.

Signed-off-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
drivers/leds/leds.h

index 2348dbda526948b380ca2c2c7bfab6e4e5e73f75..79efe57c74058ffd8fecf6583257f3b6c193b3dd 100644 (file)
@@ -20,7 +20,8 @@
 static inline void led_set_brightness_async(struct led_classdev *led_cdev,
                                        enum led_brightness value)
 {
-       led_cdev->brightness = min(value, led_cdev->max_brightness);
+       value = min(value, led_cdev->max_brightness);
+       led_cdev->brightness = value;
 
        if (!(led_cdev->flags & LED_SUSPENDED))
                led_cdev->brightness_set(led_cdev, value);