Fix error handling master
authorHugo Villeneuve <hvilleneuve@dimonoff.com>
Mon, 17 Nov 2025 18:52:16 +0000 (13:52 -0500)
committerHugo Villeneuve <hvilleneuve@dimonoff.com>
Mon, 17 Nov 2025 19:06:32 +0000 (14:06 -0500)
Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
src/main.c

index 145ec8c..aa7cccc 100644 (file)
@@ -106,10 +106,8 @@ main(int argc, char **argv)
                tlvinfo_default_tlv(eeprom);
 
                rc = prog_eeprom(eeprom);
-               if (rc) {
-                       log_err("Error writing TLV EEPROM\n");
+               if (rc)
                        exit(EXIT_FAILURE);
-               }
 
                exit(EXIT_SUCCESS);
        }
@@ -130,21 +128,19 @@ main(int argc, char **argv)
 
        if (options.tlv_cmd == TLV_CMD_ADD) {
                rc = tlvinfo_add_tlv(eeprom, options.tlv_key, options.tlv_value);
-               if (rc == false) {
-                       log_err("Error setting TLV key\n");
+               if (rc == false)
                        exit(EXIT_FAILURE);
-               }
        } else if (options.tlv_cmd == TLV_CMD_DEL) {
                rc = tlvinfo_delete_tlv(eeprom, options.tlv_key);
-               if (rc == false) {
-                       log_err("Error deleting TLV key\n");
+               if (rc == false)
                        exit(EXIT_FAILURE);
-               }
        } else if (options.tlv_cmd == TLV_CMD_LIST) {
                show_tlv_code_list();
        } else {
                if (options.tlv_key > 0) {
-                       (void) tlvinfo_show_tlv(eeprom, options.tlv_key);
+                       rc = tlvinfo_show_tlv(eeprom, options.tlv_key);
+                       if (rc == false)
+                               exit(EXIT_FAILURE);
                } else
                        show_eeprom(eeprom);
        }