X-Git-Url: http://developer.intra2net.com/git/?a=blobdiff_plain;f=examples%2Feeprom.c;h=3b8d3a6f094e72cebcd6b238b79fc3ea734b65d7;hb=fa457b38eb116eb3804de37170df70803accc4ff;hp=e2c8052669a9594e23a6ab19f05d108b541173c9;hpb=05c2e40a3c720c63a75d36a33d0d5de0677f8f57;p=libftdi diff --git a/examples/eeprom.c b/examples/eeprom.c index e2c8052..3b8d3a6 100644 --- a/examples/eeprom.c +++ b/examples/eeprom.c @@ -177,27 +177,23 @@ int main(int argc, char **argv) f, ftdi_get_error_string(ftdi)); exit(-1); } - f = ftdi_read_eeprom(ftdi); - if (f < 0) - { - fprintf(stderr, "ftdi_read_eeprom: %d (%s)\n", - f, ftdi_get_error_string(ftdi)); - exit(-1); - } } - else + f = ftdi_read_eeprom(ftdi); + if (f < 0) { - f = ftdi_read_eeprom(ftdi); - if (f < 0) - { - fprintf(stderr, "ftdi_read_eeprom: %d (%s)\n", - f, ftdi_get_error_string(ftdi)); - exit(-1); - } + fprintf(stderr, "ftdi_read_eeprom: %d (%s)\n", + f, ftdi_get_error_string(ftdi)); + exit(-1); } ftdi_get_eeprom_value(ftdi, CHIP_SIZE, & value); + if (value <0) + { + fprintf(stderr, "No EEPROM found\n"); + return -1; + + } fprintf(stderr, "Chip type %d ftdi_eeprom_size: %d\n", ftdi->type, value); if (ftdi->type == TYPE_R) size = 0xa0;