aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Keeping <john@metanate.com>2023-03-27 12:01:08 +0100
committerKever Yang <kever.yang@rock-chips.com>2023-04-21 15:16:01 +0800
commit999680c4ed80e21e014e94c9bdb79c45a5a5a853 (patch)
tree0c80483ad6aa829d8ad4d58a889fd736cf9d09c1
parent6fa83833b01c9fcd8297b71c8465df3c7fe6db31 (diff)
rockchip: misc: fix misc_read() return check
misc_read() is documented to return the number of bytes read or a negative error value. The Rockchip drivers currently do not implement this correctly and instead return zero on success or a negative error value. In preparation for fixing the drivers, fix the condition here to only error on negative values. Suggested-by: Jonas Karlman <jonas@kwiboo.se> Signed-off-by: John Keeping <john@metanate.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
-rw-r--r--arch/arm/mach-rockchip/misc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/arm/mach-rockchip/misc.c b/arch/arm/mach-rockchip/misc.c
index 849014d2fb..7d03f0c2b6 100644
--- a/arch/arm/mach-rockchip/misc.c
+++ b/arch/arm/mach-rockchip/misc.c
@@ -83,7 +83,7 @@ int rockchip_cpuid_from_efuse(const u32 cpuid_offset,
/* read the cpu_id range from the efuses */
ret = misc_read(dev, cpuid_offset, cpuid, cpuid_length);
- if (ret) {
+ if (ret < 0) {
debug("%s: reading cpuid from the efuses failed\n",
__func__);
return -1;