Skip to content
Snippets Groups Projects
Commit 9a4eb597 authored by Simon Glass's avatar Simon Glass
Browse files

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: default avatarSimon Glass <sjg@chromium.org>
Reviewed-by: default avatarBin Meng <bmeng.cn@gmail.com>
parent b26eb886
No related branches found
No related tags found
No related merge requests found
...@@ -68,7 +68,7 @@ int rtc_read32(struct udevice *dev, unsigned int reg, u32 *valuep) ...@@ -68,7 +68,7 @@ int rtc_read32(struct udevice *dev, unsigned int reg, u32 *valuep)
for (i = 0; i < sizeof(value); i++) { for (i = 0; i < sizeof(value); i++) {
ret = rtc_read8(dev, reg + i); ret = rtc_read8(dev, reg + i);
if (ret) if (ret < 0)
return ret; return ret;
value |= ret << (i << 3); value |= ret << (i << 3);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment