diff options
author | Jianlong.Huang <jianlong.huang@starfivetech.com> | 2021-10-27 04:17:57 +0300 |
---|---|---|
committer | Jianlong Huang <jianlong.huang@starfivetech.com> | 2022-11-03 11:28:42 +0300 |
commit | dc3ee50aa7d48fe929391425857e01080e322279 (patch) | |
tree | 46429375060f14d90a21cf85c36efdfed19d302e | |
parent | 642566351597bc9eca648de6ecdc6fed2a99e509 (diff) | |
download | u-boot-dc3ee50aa7d48fe929391425857e01080e322279.tar.xz |
cmd/eeprom: fix data type issue for parse_numeric_param
This patch fixs parse_numeric_param issue on some platfrom which has
different sizes of int and long, like riscv64.
On riscv64, int is 4 bytes, but long is 8 bytes.
on this situation:
ulong addr = parse_numeric_param(argv[index]);
if argv[index] is "0x80000000", this "ulong addr" will be
0xffffffff80000000.
Signed-off-by: Jianlong.Huang <jianlong.huang@starfivetech.com>
Co-developed-by: Wei Fu <wefu@redhat.com>
Signed-off-by: Wei Fu <wefu@redhat.com>
-rw-r--r-- | cmd/eeprom.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cmd/eeprom.c b/cmd/eeprom.c index efd6f3ac03..d316392f87 100644 --- a/cmd/eeprom.c +++ b/cmd/eeprom.c @@ -218,10 +218,10 @@ int eeprom_write(unsigned dev_addr, unsigned offset, return ret; } -static int parse_numeric_param(char *str) +static long parse_numeric_param(char *str) { char *endptr; - int value = simple_strtol(str, &endptr, 16); + long value = simple_strtol(str, &endptr, 16); return (*endptr != '\0') ? -1 : value; } |