The firmware upload code paths in the asix-sigma driver used to return
either the SR_OK code, or the magic number 0 for error conditions. Which
happens to be identical and cannot be told apart by callers.
Provide proper SR_ERR return codes for error conditions, such that
callers can tell whether the firmware upload succeeded.
This fixes part of bug #471.
Suggested-By: Marian Cingel <redacted>
if (ret < 0) {
sr_err("ftdi_usb_open failed: %s",
ftdi_get_error_string(ftdic));
- return 0;
+ return SR_ERR;
}
ret = ftdi_set_bitmode(ftdic, 0xdf, BITMODE_BITBANG);
if (ret < 0) {
sr_err("ftdi_set_bitmode failed: %s",
ftdi_get_error_string(ftdic));
- return 0;
+ return SR_ERR;
}
/* Four times the speed of sigmalogan - Works well. */
if (ret < 0) {
sr_err("ftdi_set_baudrate failed: %s",
ftdi_get_error_string(ftdic));
- return 0;
+ return SR_ERR;
}
/* Initialize the FPGA for firmware upload. */