if (ret == 0 && is_valid_tlvinfo_header(eeprom_hdr))
ret = read_tlv_eeprom((void *)eeprom_tlv, HDR_SIZE,
be16_to_cpu(eeprom_hdr->totallen), devnum);
+ else if (ret == -ENODEV)
+ return ret;
// If the contents are invalid, start over with default contents
if (!is_valid_tlvinfo_header(eeprom_hdr) ||
// If no arguments, read the EERPOM and display its contents
if (argc == 1) {
if (!has_been_read) {
- if (read_eeprom(current_dev, eeprom) == 0)
- has_been_read = 1;
+ ret = read_eeprom(current_dev, eeprom);
+ if (ret) {
+ printf("Failed to read EEPROM data from device.\n");
+ return 0;
+ }
+
+ has_been_read = 1;
}
show_eeprom(current_dev, eeprom);
return 0;
// Read the EEPROM contents
if (cmd == 'r') {
has_been_read = 0;
- if (read_eeprom(current_dev, eeprom) == 0) {
- printf("EEPROM data loaded from device to memory.\n");
- has_been_read = 1;
+ ret = read_eeprom(current_dev, eeprom);
+ if (ret) {
+ printf("Failed to read EEPROM data from device.\n");
+ return 0;
}
- return 0;
+
+ printf("EEPROM data loaded from device to memory.\n");
+ has_been_read = 1;
}
// Subsequent commands require that the EEPROM has already been read.