From 9a940bf295337153728e69afdbfee8776170b7bb Mon Sep 17 00:00:00 2001 From: Nico Huber Date: Mon, 20 May 2019 14:13:12 +0200 Subject: drivers/i2c/lm96000: Fix integer sign issue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/35474 Tested-by: build bot (Jenkins) Reviewed-by: Kyösti Mälkki --- src/drivers/i2c/lm96000/lm96000.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') 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; } -- cgit v1.2.3