Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 15444
b: refs/heads/master
c: 8d7802e
h: refs/heads/master
v: v3
  • Loading branch information
matthieu castet authored and Greg Kroah-Hartman committed Jan 4, 2006
1 parent 8383c96 commit 93f8ce6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b72458a80c75cab832248f536412f386e20a93a0
refs/heads/master: 8d7802ed3c617120863f84346638d1cf1c96137b
28 changes: 18 additions & 10 deletions trunk/drivers/usb/atm/ueagle-atm.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,14 +426,14 @@ static void uea_upload_pre_firmware(const struct firmware *fw_entry, void *conte

pfw = fw_entry->data;
size = fw_entry->size;
if (size < 4)
goto err_fw_corrupted;

crc = FW_GET_LONG(pfw);
pfw += 4;
size -= 4;
if (crc32_be(0, pfw, size) != crc) {
uea_err(usb, "firmware is corrupted\n");
goto err;
}
if (crc32_be(0, pfw, size) != crc)
goto err_fw_corrupted;

/*
* Start to upload formware : send reset
Expand All @@ -446,19 +446,26 @@ static void uea_upload_pre_firmware(const struct firmware *fw_entry, void *conte
goto err;
}

while (size > 0) {
while (size > 3) {
u8 len = FW_GET_BYTE(pfw);
u16 add = FW_GET_WORD(pfw + 1);

size -= len + 3;
if (size < 0)
goto err_fw_corrupted;

ret = uea_send_modem_cmd(usb, add, len, pfw + 3);
if (ret < 0) {
uea_err(usb, "uploading firmware data failed "
"with error %d\n", ret);
goto err;
}
pfw += len + 3;
size -= len + 3;
}

if (size != 0)
goto err_fw_corrupted;

/*
* Tell the modem we finish : de-assert reset
*/
Expand All @@ -469,6 +476,11 @@ static void uea_upload_pre_firmware(const struct firmware *fw_entry, void *conte
else
uea_info(usb, "firmware uploaded\n");

uea_leaves(usb);
return;

err_fw_corrupted:
uea_err(usb, "firmware is corrupted\n");
err:
uea_leaves(usb);
}
Expand Down Expand Up @@ -522,10 +534,6 @@ static int check_dsp(u8 *dsp, unsigned int len)
u32 pageoffset;
unsigned int i, j, p, pp;

/* enough space for pagecount? */
if (len < 1)
return 1;

pagecount = FW_GET_BYTE(dsp);
p = 1;

Expand Down

0 comments on commit 93f8ce6

Please sign in to comment.