dm: rtc: Correct rtc_read32() return value
authorSimon Glass <sjg@chromium.org>
Sun, 18 Oct 2015 21:55:31 +0000 (15:55 -0600)
committerSimon Glass <sjg@chromium.org>
Wed, 21 Oct 2015 13:46:50 +0000 (07:46 -0600)
The current check is incorrect and will fail when any non-zero byte is read.
Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
drivers/rtc/rtc-uclass.c

index fe74c69f97ec3a3ebb9164a0e585b482b6d66628..300e9b30ec9576b6c193caaf18217b81b4dbae12 100644 (file)
@@ -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);
        }