summaryrefslogtreecommitdiff
path: root/common/keyboard_backlight.c
diff options
context:
space:
mode:
authorCaveh Jalali <caveh@chromium.org>2018-08-14 20:34:05 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-08-15 12:54:51 -0700
commit1bbca019b658618b070ddeffbd16f2978b0f515b (patch)
treec400e30b696e7eb67f0d1cee62c6c23bd0428b42 /common/keyboard_backlight.c
parent402428583940d25708deb637554f32f6dc16edca (diff)
downloadchrome-ec-1bbca019b658618b070ddeffbd16f2978b0f515b.tar.gz
kblight: fix bounds checks on backlight intensity
looks like we were performing the bounds check on a global variable instead of the input to the function... BUG=none BRANCH=none TEST=EC console kblight command now correctly catches out of range values Change-Id: Ia54e42bfbc284eea64f7e6f7defaa2400c20e471 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1175544 Commit-Ready: caveh jalali <caveh@chromium.org> Tested-by: caveh jalali <caveh@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: caveh jalali <caveh@chromium.org>
Diffstat (limited to 'common/keyboard_backlight.c')
-rw-r--r--common/keyboard_backlight.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/common/keyboard_backlight.c b/common/keyboard_backlight.c
index d17c2bd319..8fdc5dc0cf 100644
--- a/common/keyboard_backlight.c
+++ b/common/keyboard_backlight.c
@@ -41,7 +41,7 @@ DECLARE_DEFERRED(kblight_set_deferred);
*/
int kblight_set(int percent)
{
- if (current_percent < 0 || 100 < current_percent)
+ if (percent < 0 || 100 < percent)
return EC_ERROR_INVAL;
current_percent = percent;
/* Need to defer i2c in case it's called from an interrupt handler. */