diff options
author | Angel Pons <th3fanbus@gmail.com> | 2021-04-26 18:05:42 +0200 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2021-04-29 05:26:11 +0000 |
commit | 9157ccb097d853645e8b1f4a6d82a93d677f6b1b (patch) | |
tree | 5c4cb2312bf04b25ddaaf078c0cdb8397e1d6c81 /src/ec | |
parent | bd9d6ab2d5631cd9391114a57840a51416067b3e (diff) |
ec/lenovo/h8/h8.c: Skip setting volume if out of range
This change is needed to update the option API to use unsigned integers.
The CMOS option system does not support negative numbers.
The volume field is only 8 bits long. Do not set the volume if it is out
of range. Also, use an out-of-range value as fallback to skip setting
the volume when it cannot be read using the option API, to preserve the
current behavior.
Change-Id: I7af68bb5c1ecd4489ab4b826b9a5e7999c77b1ff
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/52675
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Diffstat (limited to 'src/ec')
-rw-r--r-- | src/ec/lenovo/h8/h8.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ec/lenovo/h8/h8.c b/src/ec/lenovo/h8/h8.c index be2eee6f74..e17f0fb2d4 100644 --- a/src/ec/lenovo/h8/h8.c +++ b/src/ec/lenovo/h8/h8.c @@ -299,8 +299,8 @@ static void h8_enable(struct device *dev) h8_trackpoint_enable(1); h8_usb_power_enable(1); - int volume = get_int_option("volume", -1); - if (volume >= 0 && !acpi_is_wakeup_s3()) + unsigned int volume = get_int_option("volume", ~0); + if (volume <= 0xff && !acpi_is_wakeup_s3()) ec_write(H8_VOLUME_CONTROL, volume); val = (CONFIG(H8_SUPPORT_BT_ON_WIFI) || h8_has_bdc(dev)) && |