asix-sigma: Propagate errors from firmware upload

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 <cingel.marian@gmail.com>
This commit is contained in:
Gerhard Sittig 2017-06-25 12:01:43 +02:00 committed by Uwe Hermann
parent ad466f86cc
commit 7bcf21683e
1 changed files with 3 additions and 3 deletions

View File

@ -462,14 +462,14 @@ static int upload_firmware(struct sr_context *ctx,
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. */
@ -477,7 +477,7 @@ static int upload_firmware(struct sr_context *ctx,
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. */