From: Simon Glass Date: Sun, 18 Oct 2015 21:55:31 +0000 (-0600) Subject: dm: rtc: Correct rtc_read32() return value X-Git-Tag: v2016.01-rc1~298^2~6 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a4eb5977ad5dc2516e1219613258e30b10d27bd;p=pandora-u-boot.git dm: rtc: Correct rtc_read32() return value The current check is incorrect and will fail when any non-zero byte is read. Fix it. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- diff --git a/drivers/rtc/rtc-uclass.c b/drivers/rtc/rtc-uclass.c index fe74c69f97e..300e9b30ec9 100644 --- a/drivers/rtc/rtc-uclass.c +++ b/drivers/rtc/rtc-uclass.c @@ -68,7 +68,7 @@ int rtc_read32(struct udevice *dev, unsigned int reg, u32 *valuep) for (i = 0; i < sizeof(value); i++) { ret = rtc_read8(dev, reg + i); - if (ret) + if (ret < 0) return ret; value |= ret << (i << 3); }