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>
This commit is contained in:
Nico Huber 2019-05-20 14:13:12 +02:00 committed by Patrick Georgi
parent 5fb34e87eb
commit 9a940bf295
1 changed files with 4 additions and 3 deletions

View File

@ -178,20 +178,21 @@ static void lm96000_configure_temp_zone(struct device *const dev,
static void lm96000_init(struct device *const dev) static void lm96000_init(struct device *const dev)
{ {
const struct drivers_i2c_lm96000_config *const config = dev->chip_info; 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; struct stopwatch sw;
printk(BIOS_DEBUG, "lm96000: Initialization hardware monitoring.\n"); printk(BIOS_DEBUG, "lm96000: Initialization hardware monitoring.\n");
stopwatch_init_msecs_expire(&sw, 1000); stopwatch_init_msecs_expire(&sw, 1000);
lm_config = lm96000_read(dev, LM96000_CONFIG); 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); mdelay(1);
lm_config = lm96000_read(dev, LM96000_CONFIG); lm_config = lm96000_read(dev, LM96000_CONFIG);
if (stopwatch_expired(&sw)) if (stopwatch_expired(&sw))
break; 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"); printk(BIOS_INFO, "lm96000: Not ready after 1s.\n");
return; return;
} }