Skip to content

Commit

Permalink
staging: ft1000: return values corrected in scram_start_dwnld
Browse files Browse the repository at this point in the history
The ft1000 usb driver ignores expected Linux error codes, and uses two
values defined in ft1000_usb.h: STATUS_SUCCESS 0, and STATUS_FAILURE
0x1001; and sometimes -1. This patch changes the return values of the
function scram_start_dwnld to match the status of the handshake returned
by its helper functions, get_handshake and get_handshake_usb. If the
handshake fails, -ENETRESET is returned instead of the inappropriate
STATUS_FAILURE. Also, a new test has been added to differentiate failure
due to timeout from failure due to net reset (the default). -ETIMEDOUT
is returned in this case. Finally, 0 is returned on success instead of
STATUS_SUCCESS.

Signed-off-by: Kelley Nielsen <kelleynnn@gmail.com>
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Kelley Nielsen authored and Greg Kroah-Hartman committed Oct 30, 2013
1 parent 43fc69b commit b1bdd4d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/staging/ft1000/ft1000-usb/ft1000_download.c
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ static int write_blk_fifo(struct ft1000_usb *ft1000dev, u16 **pUsFile,
static int scram_start_dwnld(struct ft1000_usb *ft1000dev, u16 *hshake,
u32 *state)
{
int status = STATUS_SUCCESS;
int status = 0;

DEBUG("FT1000:STATE_START_DWNLD\n");
if (ft1000dev->usbboot)
Expand All @@ -564,9 +564,11 @@ static int scram_start_dwnld(struct ft1000_usb *ft1000dev, u16 *hshake,
if (*hshake == HANDSHAKE_DSP_BL_READY) {
DEBUG("scram_dnldr: handshake is HANDSHAKE_DSP_BL_READY, call put_handshake(HANDSHAKE_DRIVER_READY)\n");
put_handshake(ft1000dev, HANDSHAKE_DRIVER_READY);
} else if (*hshake == HANDSHAKE_TIMEOUT_VALUE) {
status = -ETIMEDOUT;
} else {
DEBUG("FT1000:download:Download error: Handshake failed\n");
status = STATUS_FAILURE;
status = -ENETRESET;
}
*state = STATE_BOOT_DWNLD;
return status;
Expand Down

0 comments on commit b1bdd4d

Please sign in to comment.