From 7cc1b02f8f73fc0b5e1531a1e16b1c00819d5222 Mon Sep 17 00:00:00 2001 From: Darwin Rambo Date: Fri, 13 Dec 2013 12:57:26 -0800 Subject: [PATCH] i2c: Fix i2c speed command This corrects i2c core to interpret the value returned by i2c_set_bus_speed as a success indicator rather than the actual speed that was set. When i2c_set_bus_speed returns a failure code, the speed is unknown so the adapter speed is set to zero. Signed-off-by: Darwin Rambo Reviewed-by: Tim Kryger Reviewed-by: Steve Rae Acked-by: Jagannadha Sutradharudu Teki --- drivers/i2c/i2c_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/i2c_core.c b/drivers/i2c/i2c_core.c index e1767f4bd4..18d6736601 100644 --- a/drivers/i2c/i2c_core.c +++ b/drivers/i2c/i2c_core.c @@ -349,7 +349,7 @@ unsigned int i2c_set_bus_speed(unsigned int speed) return 0; ret = I2C_ADAP->set_bus_speed(I2C_ADAP, speed); if (gd->flags & GD_FLG_RELOC) - I2C_ADAP->speed = ret; + I2C_ADAP->speed = (ret == 0) ? speed : 0; return ret; } -- 2.39.2