From: Gabriele Mazzotta Date: Tue, 23 Dec 2014 18:59:23 +0000 (-0800) Subject: leds: Don't allow brightness values greater than max_brightness X-Git-Tag: v4.0-rc1~92^2~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=56d06fdee534124f79b51ff92232373b783cddc2;p=thirdparty%2Fkernel%2Flinux.git 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 Signed-off-by: Bryan Wu --- diff --git a/drivers/leds/leds.h b/drivers/leds/leds.h index 2348dbda52694..79efe57c74058 100644 --- a/drivers/leds/leds.h +++ b/drivers/leds/leds.h @@ -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);