提交 56d06fde 编写于 作者: G Gabriele Mazzotta 提交者: Bryan Wu

leds: Don't allow brightness values greater than max_brightness

Since commit 4d71a4a1 ("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: NGabriele Mazzotta <gabriele.mzt@gmail.com>
Signed-off-by: NBryan Wu <cooloney@gmail.com>
上级 13b695f3
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册