mirror of
https://github.com/torvalds/linux.git
synced 2024-11-24 05:02:12 +00:00
leds: Don't allow brightness values greater than max_brightness
Since commit 4d71a4a12b
("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>
This commit is contained in:
parent
13b695f3c4
commit
56d06fdee5
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user