mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-15 19:51:37 +00:00
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>
This commit is contained in:
parent
f4bbb9dcb2
commit
c9954fb33e
1 changed files with 2 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue