summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNico Huber <nico.huber@secunet.com>2019-05-20 14:13:12 +0200
committerPatrick Georgi <pgeorgi@google.com>2019-09-30 11:51:41 +0000
commit9a940bf295337153728e69afdbfee8776170b7bb (patch)
treee5c4f311945396ba39baeaced05aed34b329bfe2
parent5fb34e87eb94294b37420493d6863983673fa4a0 (diff)
downloadcoreboot-9a940bf295337153728e69afdbfee8776170b7bb.tar.xz
drivers/i2c/lm96000: Fix integer sign issue
We accidentally converted an `int` return value to an `unsigned`, making it impossible to check for errors with `< 0`. Fix that by using an `int` variable. Change-Id: I5433c27e334bc177913e138df83118b128c674b7 Signed-off-by: Nico Huber <nico.huber@secunet.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/35474 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
-rw-r--r--src/drivers/i2c/lm96000/lm96000.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/drivers/i2c/lm96000/lm96000.c b/src/drivers/i2c/lm96000/lm96000.c
index 4bb2a4a8b4..4a3c2eba14 100644
--- a/src/drivers/i2c/lm96000/lm96000.c
+++ b/src/drivers/i2c/lm96000/lm96000.c
@@ -178,20 +178,21 @@ static void lm96000_configure_temp_zone(struct device *const dev,
static void lm96000_init(struct device *const dev)
{
const struct drivers_i2c_lm96000_config *const config = dev->chip_info;
- unsigned int i, lm_config;
+ unsigned int i;
+ int lm_config;
struct stopwatch sw;
printk(BIOS_DEBUG, "lm96000: Initialization hardware monitoring.\n");
stopwatch_init_msecs_expire(&sw, 1000);
lm_config = lm96000_read(dev, LM96000_CONFIG);
- while ((lm_config < 0 || !(lm_config & LM96000_READY))) {
+ while ((lm_config < 0 || !((unsigned int)lm_config & LM96000_READY))) {
mdelay(1);
lm_config = lm96000_read(dev, LM96000_CONFIG);
if (stopwatch_expired(&sw))
break;
}
- if (lm_config < 0 || !(lm_config & LM96000_READY)) {
+ if (lm_config < 0 || !((unsigned int)lm_config & LM96000_READY)) {
printk(BIOS_INFO, "lm96000: Not ready after 1s.\n");
return;
}