diff options
author | Gabriele Mazzotta <gabriele.mzt@gmail.com> | 2014-12-23 13:59:23 -0500 |
---|---|---|
committer | Bryan Wu <cooloney@gmail.com> | 2015-01-14 13:40:19 -0500 |
commit | 56d06fdee534124f79b51ff92232373b783cddc2 (patch) | |
tree | 126c70b1e945ab98c4458182652a556cdf094ef9 /drivers/leds | |
parent | 13b695f3c41bc691028f255eae2f8e1938377565 (diff) |
leds: Don't allow brightness values greater than max_brightness
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>
Diffstat (limited to 'drivers/leds')
-rw-r--r-- | drivers/leds/leds.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/leds/leds.h b/drivers/leds/leds.h index 2348dbda5269..79efe57c7405 100644 --- a/drivers/leds/leds.h +++ b/drivers/leds/leds.h | |||
@@ -20,7 +20,8 @@ | |||
20 | static inline void led_set_brightness_async(struct led_classdev *led_cdev, | 20 | static inline void led_set_brightness_async(struct led_classdev *led_cdev, |
21 | enum led_brightness value) | 21 | enum led_brightness value) |
22 | { | 22 | { |
23 | led_cdev->brightness = min(value, led_cdev->max_brightness); | 23 | value = min(value, led_cdev->max_brightness); |
24 | led_cdev->brightness = value; | ||
24 | 25 | ||
25 | if (!(led_cdev->flags & LED_SUSPENDED)) | 26 | if (!(led_cdev->flags & LED_SUSPENDED)) |
26 | led_cdev->brightness_set(led_cdev, value); | 27 | led_cdev->brightness_set(led_cdev, value); |