staging: ft1000: STATUS_ defines removed from ft1000_download.c
Two files in the ft1000 usb driver ignore expected Linux error codes, and instead use two STATUS_SUCCESS 0, and STATUS_FAILURE 0x1001. This patch removes all remaining occurrences of these from the file ft1000_download.c. All occurrences of STATUS_SUCCESS have been replaced by 0, and occurrences of STATUS_FAILURE have been replaced by -1. One occurence of STATUS_FAILURE has been completely removed: get_handshake collects either a local #define or 0 from its helper function, check_usb_db, and immediately sets the collecting variable to STATUS_FAILURE if the #define is returned. check_usb_db has been modified to return -1 instead of the #define. Signed-off-by: Kelley Nielsen <kelleynnn@gmail.com> Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
ed5d6ca003
commit
547b5b2256
@ -151,7 +151,7 @@ static int check_usb_db(struct ft1000_usb *ft1000dev)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return HANDSHAKE_MAG_TIMEOUT_VALUE;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* gets the handshake and compares it with the expected value */
|
/* gets the handshake and compares it with the expected value */
|
||||||
@ -172,9 +172,8 @@ static u16 get_handshake(struct ft1000_usb *ft1000dev, u16 expected_value)
|
|||||||
ft1000dev->fcodeldr);
|
ft1000dev->fcodeldr);
|
||||||
ft1000dev->fcodeldr = 0;
|
ft1000dev->fcodeldr = 0;
|
||||||
status = check_usb_db(ft1000dev);
|
status = check_usb_db(ft1000dev);
|
||||||
if (status != STATUS_SUCCESS) {
|
if (status != 0) {
|
||||||
DEBUG("get_handshake: check_usb_db failed\n");
|
DEBUG("get_handshake: check_usb_db failed\n");
|
||||||
status = STATUS_FAILURE;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
status = ft1000_write_register(ft1000dev,
|
status = ft1000_write_register(ft1000dev,
|
||||||
@ -450,7 +449,7 @@ static int write_dpram32_and_check(struct ft1000_usb *ft1000dev,
|
|||||||
static int write_blk(struct ft1000_usb *ft1000dev, u16 **pUsFile, u8 **pUcFile,
|
static int write_blk(struct ft1000_usb *ft1000dev, u16 **pUsFile, u8 **pUcFile,
|
||||||
long word_length)
|
long word_length)
|
||||||
{
|
{
|
||||||
int status = STATUS_SUCCESS;
|
int status = 0;
|
||||||
u16 dpram;
|
u16 dpram;
|
||||||
int loopcnt, i;
|
int loopcnt, i;
|
||||||
u16 tempword;
|
u16 tempword;
|
||||||
@ -499,7 +498,7 @@ static int write_blk(struct ft1000_usb *ft1000dev, u16 **pUsFile, u8 **pUcFile,
|
|||||||
} else {
|
} else {
|
||||||
status = write_dpram32_and_check(ft1000dev, tempbuffer,
|
status = write_dpram32_and_check(ft1000dev, tempbuffer,
|
||||||
dpram);
|
dpram);
|
||||||
if (status != STATUS_SUCCESS) {
|
if (status != 0) {
|
||||||
DEBUG("FT1000:download:Write failed tempbuffer[31] = 0x%x\n", tempbuffer[31]);
|
DEBUG("FT1000:download:Write failed tempbuffer[31] = 0x%x\n", tempbuffer[31]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -523,7 +522,7 @@ static void usb_dnld_complete (struct urb *urb)
|
|||||||
static int write_blk_fifo(struct ft1000_usb *ft1000dev, u16 **pUsFile,
|
static int write_blk_fifo(struct ft1000_usb *ft1000dev, u16 **pUsFile,
|
||||||
u8 **pUcFile, long word_length)
|
u8 **pUcFile, long word_length)
|
||||||
{
|
{
|
||||||
int Status = STATUS_SUCCESS;
|
int Status = 0;
|
||||||
int byte_length;
|
int byte_length;
|
||||||
|
|
||||||
byte_length = word_length * 4;
|
byte_length = word_length * 4;
|
||||||
@ -586,12 +585,12 @@ static int request_code_segment(struct ft1000_usb *ft1000dev, u16 **s_file,
|
|||||||
/*NdisMSleep (100); */
|
/*NdisMSleep (100); */
|
||||||
if (word_length > MAX_LENGTH) {
|
if (word_length > MAX_LENGTH) {
|
||||||
DEBUG("FT1000:download:Download error: Max length exceeded\n");
|
DEBUG("FT1000:download:Download error: Max length exceeded\n");
|
||||||
return STATUS_FAILURE;
|
return -1;
|
||||||
}
|
}
|
||||||
if ((word_length * 2 + (long)c_file) > (long)endpoint) {
|
if ((word_length * 2 + (long)c_file) > (long)endpoint) {
|
||||||
/* Error, beyond boot code range.*/
|
/* Error, beyond boot code range.*/
|
||||||
DEBUG("FT1000:download:Download error: Requested len=%d exceeds BOOT code boundary.\n", (int)word_length);
|
DEBUG("FT1000:download:Download error: Requested len=%d exceeds BOOT code boundary.\n", (int)word_length);
|
||||||
return STATUS_FAILURE;
|
return -1;
|
||||||
}
|
}
|
||||||
if (word_length & 0x1)
|
if (word_length & 0x1)
|
||||||
word_length++;
|
word_length++;
|
||||||
@ -615,7 +614,7 @@ static int request_code_segment(struct ft1000_usb *ft1000dev, u16 **s_file,
|
|||||||
int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
|
int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
|
||||||
u32 FileLength)
|
u32 FileLength)
|
||||||
{
|
{
|
||||||
int status = STATUS_SUCCESS;
|
int status = 0;
|
||||||
u32 state;
|
u32 state;
|
||||||
u16 handshake;
|
u16 handshake;
|
||||||
struct pseudo_hdr *pseudo_header;
|
struct pseudo_hdr *pseudo_header;
|
||||||
@ -670,7 +669,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
|
|||||||
loader_code_size = file_hdr->loader_code_size;
|
loader_code_size = file_hdr->loader_code_size;
|
||||||
correct_version = false;
|
correct_version = false;
|
||||||
|
|
||||||
while ((status == STATUS_SUCCESS) && (state != STATE_DONE_FILE)) {
|
while ((status == 0) && (state != STATE_DONE_FILE)) {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case STATE_START_DWNLD:
|
case STATE_START_DWNLD:
|
||||||
status = scram_start_dwnld(ft1000dev, &handshake,
|
status = scram_start_dwnld(ft1000dev, &handshake,
|
||||||
@ -717,7 +716,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
|
|||||||
DEBUG
|
DEBUG
|
||||||
("FT1000:download:Download error: Bad request type=%d in BOOT download state.\n",
|
("FT1000:download:Download error: Bad request type=%d in BOOT download state.\n",
|
||||||
request);
|
request);
|
||||||
status = STATUS_FAILURE;
|
status = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (ft1000dev->usbboot)
|
if (ft1000dev->usbboot)
|
||||||
@ -729,7 +728,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
|
|||||||
} else {
|
} else {
|
||||||
DEBUG
|
DEBUG
|
||||||
("FT1000:download:Download error: Handshake failed\n");
|
("FT1000:download:Download error: Handshake failed\n");
|
||||||
status = STATUS_FAILURE;
|
status = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -773,7 +772,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
|
|||||||
} else {
|
} else {
|
||||||
DEBUG
|
DEBUG
|
||||||
("FT1000:download:Download error: Got Run address request before image offset request.\n");
|
("FT1000:download:Download error: Got Run address request before image offset request.\n");
|
||||||
status = STATUS_FAILURE;
|
status = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -789,7 +788,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
|
|||||||
} else {
|
} else {
|
||||||
DEBUG
|
DEBUG
|
||||||
("FT1000:download:Download error: Got Size request before image offset request.\n");
|
("FT1000:download:Download error: Got Size request before image offset request.\n");
|
||||||
status = STATUS_FAILURE;
|
status = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -809,7 +808,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
|
|||||||
if (!correct_version) {
|
if (!correct_version) {
|
||||||
DEBUG
|
DEBUG
|
||||||
("FT1000:download:Download error: Got Code Segment request before image offset request.\n");
|
("FT1000:download:Download error: Got Code Segment request before image offset request.\n");
|
||||||
status = STATUS_FAILURE;
|
status = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -948,7 +947,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
|
|||||||
DEBUG
|
DEBUG
|
||||||
("FT1000:download:Download error: Bad Version Request = 0x%x.\n",
|
("FT1000:download:Download error: Bad Version Request = 0x%x.\n",
|
||||||
(int)requested_version);
|
(int)requested_version);
|
||||||
status = STATUS_FAILURE;
|
status = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -957,7 +956,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
|
|||||||
DEBUG
|
DEBUG
|
||||||
("FT1000:download:Download error: Bad request type=%d in CODE download state.\n",
|
("FT1000:download:Download error: Bad request type=%d in CODE download state.\n",
|
||||||
request);
|
request);
|
||||||
status = STATUS_FAILURE;
|
status = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (ft1000dev->usbboot)
|
if (ft1000dev->usbboot)
|
||||||
@ -969,7 +968,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
|
|||||||
} else {
|
} else {
|
||||||
DEBUG
|
DEBUG
|
||||||
("FT1000:download:Download error: Handshake failed\n");
|
("FT1000:download:Download error: Handshake failed\n");
|
||||||
status = STATUS_FAILURE;
|
status = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -1026,14 +1025,14 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
kfree(pbuffer);
|
kfree(pbuffer);
|
||||||
status = STATUS_FAILURE;
|
status = -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
status = STATUS_FAILURE;
|
status = -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Checksum did not compute */
|
/* Checksum did not compute */
|
||||||
status = STATUS_FAILURE;
|
status = -1;
|
||||||
}
|
}
|
||||||
DEBUG
|
DEBUG
|
||||||
("ft1000:download: after STATE_SECTION_PROV, state = %d, status= %d\n",
|
("ft1000:download: after STATE_SECTION_PROV, state = %d, status= %d\n",
|
||||||
@ -1046,11 +1045,11 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
status = STATUS_FAILURE;
|
status = -1;
|
||||||
break;
|
break;
|
||||||
} /* End Switch */
|
} /* End Switch */
|
||||||
|
|
||||||
if (status != STATUS_SUCCESS)
|
if (status != 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/****
|
/****
|
||||||
|
Loading…
Reference in New Issue
Block a user