summaryrefslogtreecommitdiff
path: root/common/eeprom
diff options
context:
space:
mode:
authorMarek BehĂșn <kabel@kernel.org>2024-05-21 09:13:27 +0200
committerTom Rini <trini@konsulko.com>2024-06-07 10:47:59 -0600
commit96dfa5869da586eb1c8d84c22164a2bf399968a1 (patch)
tree3dcf8ba1445956b67c9f7402dee7ddcb4cfbf64c /common/eeprom
parent15378a3fe1838a3c5abf2330a6eb4e92462783c1 (diff)
downloadu-boot-96dfa5869da586eb1c8d84c22164a2bf399968a1.tar.gz
u-boot-96dfa5869da586eb1c8d84c22164a2bf399968a1.tar.bz2
u-boot-96dfa5869da586eb1c8d84c22164a2bf399968a1.zip
common: eeprom_field: Fix updating binary field
The __eeprom_field_update_bin() function is expected to parse a hex string into bytes (potentially in reverse order), but the simple_strtoul() function is given 0 as base. This does not work since the string does not contain '0x' prefix. Add explicit base 16. Signed-off-by: Marek BehĂșn <kabel@kernel.org>
Diffstat (limited to 'common/eeprom')
-rw-r--r--common/eeprom/eeprom_field.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/common/eeprom/eeprom_field.c b/common/eeprom/eeprom_field.c
index f56eebe679..9b831414a4 100644
--- a/common/eeprom/eeprom_field.c
+++ b/common/eeprom/eeprom_field.c
@@ -55,7 +55,7 @@ static int __eeprom_field_update_bin(struct eeprom_field *field,
tmp[k] = value[reverse ? i - 1 + k : i + k];
}
- byte = simple_strtoul(tmp, &endptr, 0);
+ byte = simple_strtoul(tmp, &endptr, 16);
if (*endptr != '\0' || byte < 0)
return -1;