diff options
author | Nico Huber <nico.huber@secunet.com> | 2013-07-18 12:27:00 +0200 |
---|---|---|
committer | Stefan Reinauer <stefan.reinauer@coreboot.org> | 2013-07-29 23:22:12 +0200 |
commit | ca4f073f8ee3b7d2bf4d7f1ca63fc5957e6feae2 (patch) | |
tree | e32accd42ff330e31c5539d6588e5f99ccebc925 /src/ec/kontron/it8516e/ec.c | |
parent | 1f9f67864ab3d16beba3d6835d09ce44d4812989 (diff) | |
download | coreboot-ca4f073f8ee3b7d2bf4d7f1ca63fc5957e6feae2.tar.xz |
ec/kontron/it8516e: Add sanity checks for values from nvram
Change-Id: Ie52d80fc8657064efdcec51c31dc9309fcc28121
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: http://review.coreboot.org/3787
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Diffstat (limited to 'src/ec/kontron/it8516e/ec.c')
-rw-r--r-- | src/ec/kontron/it8516e/ec.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/ec/kontron/it8516e/ec.c b/src/ec/kontron/it8516e/ec.c index 721412199d..925b7ea524 100644 --- a/src/ec/kontron/it8516e/ec.c +++ b/src/ec/kontron/it8516e/ec.c @@ -170,6 +170,8 @@ static void it8516e_set_fan_from_options(const config_t *const config, "Setting it8516e fan%d " "control to %d%% PWM.\n", fan_idx + 1, fan_target); + if (fan_target > 100) /* Constrain to 100% */ + fan_target = 100; it8516e_set_fan_pwm(fan_idx, (fan_target * 255) / 100); break; case IT8516E_MODE_SPEED: @@ -183,6 +185,8 @@ static void it8516e_set_fan_from_options(const config_t *const config, printk(BIOS_DEBUG, "Setting it8516e fan%d control to %d C.\n", fan_idx + 1, fan_target); + if (fan_target > 1024) /* Constrain to 1K */ + fan_target = 1024; it8516e_set_fan_temperature(fan_idx, fan_target * 64); fanX_min[3] = '1' + fan_idx; |