Patrick Georgi has submitted this change. ( https://review.coreboot.org/c/coreboot/+/35474 )
Change subject: drivers/i2c/lm96000: Fix integer sign issue ......................................................................
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 --- M src/drivers/i2c/lm96000/lm96000.c 1 file changed, 4 insertions(+), 3 deletions(-)
Approvals: build bot (Jenkins): Verified Kyösti Mälkki: Looks good to me, approved
diff --git a/src/drivers/i2c/lm96000/lm96000.c b/src/drivers/i2c/lm96000/lm96000.c index 4bb2a4a..4a3c2eb 100644 --- a/src/drivers/i2c/lm96000/lm96000.c +++ b/src/drivers/i2c/lm96000/lm96000.c @@ -178,20 +178,21 @@ 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; }