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 <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
Simon Glass 2015-10-18 15:55:31 -06:00
parent b26eb88658
commit 9a4eb5977a

View 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);
}