projects
/
mtlv.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ea6f934
)
tlv_eeprom: delete old key before updating if it already exists
author
Hugo Villeneuve
<hvilleneuve@dimonoff.com>
Wed, 5 Nov 2025 17:09:58 +0000
(12:09 -0500)
committer
Hugo Villeneuve
<hvilleneuve@dimonoff.com>
Mon, 17 Nov 2025 15:36:11 +0000
(10:36 -0500)
Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
src/tlv_eeprom.c
patch
|
blob
|
history
diff --git
a/src/tlv_eeprom.c
b/src/tlv_eeprom.c
index
a1a5d96
..
967e6dd
100644
(file)
--- a/
src/tlv_eeprom.c
+++ b/
src/tlv_eeprom.c
@@
-472,6
+472,15
@@
bool tlvinfo_add_tlv(u8 *eeprom, int tcode, char *strval)
u32 value;
char data[MAX_TLV_VALUE_LEN];
int eeprom_index;
+ int ret;
+
+ /* First check if an existing key exist: */
+ if (tlvinfo_find_tlv(eeprom, tcode, &eeprom_index)) {
+ /* If yes, delete old key first (update mode) : */
+ ret = tlvinfo_delete_tlv(eeprom, tcode);
+ if (!ret)
+ return false;
+ }
// Encode each TLV type into the format to be stored in the EEPROM
switch (tcode) {