[PATCH] isicom: correct firmware loading
- loading of firmware didn't fail when something went wrong (returned 0). - pointer to frame was incremented only by sizeof(frame) excluding its data contents -- bad idea. - tell the card we're ready just after checking is complete, not before. Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
3f27100872
commit
e4e040887b
|
@ -1756,9 +1756,12 @@ static int __devinit load_firmware(struct pci_dev *pdev,
|
||||||
if (retval)
|
if (retval)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
|
retval = -EIO;
|
||||||
|
|
||||||
for (frame = (struct stframe *)fw->data;
|
for (frame = (struct stframe *)fw->data;
|
||||||
frame < (struct stframe *)(fw->data + fw->size);
|
frame < (struct stframe *)(fw->data + fw->size);
|
||||||
frame++) {
|
frame = (struct stframe *)((u8 *)(frame + 1) +
|
||||||
|
frame->count)) {
|
||||||
if (WaitTillCardIsFree(base))
|
if (WaitTillCardIsFree(base))
|
||||||
goto errrelfw;
|
goto errrelfw;
|
||||||
|
|
||||||
|
@ -1797,23 +1800,12 @@ static int __devinit load_firmware(struct pci_dev *pdev,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
retval = -EIO;
|
|
||||||
|
|
||||||
if (WaitTillCardIsFree(base))
|
|
||||||
goto errrelfw;
|
|
||||||
|
|
||||||
outw(0xf2, base);
|
|
||||||
outw(0x800, base);
|
|
||||||
outw(0x0, base);
|
|
||||||
outw(0x0, base);
|
|
||||||
InterruptTheCard(base);
|
|
||||||
outw(0x0, base + 0x4); /* for ISI4608 cards */
|
|
||||||
|
|
||||||
/* XXX: should we test it by reading it back and comparing with original like
|
/* XXX: should we test it by reading it back and comparing with original like
|
||||||
* in load firmware package? */
|
* in load firmware package? */
|
||||||
for (frame = (struct stframe*)fw->data;
|
for (frame = (struct stframe *)fw->data;
|
||||||
frame < (struct stframe*)(fw->data + fw->size);
|
frame < (struct stframe *)(fw->data + fw->size);
|
||||||
frame++) {
|
frame = (struct stframe *)((u8 *)(frame + 1) +
|
||||||
|
frame->count)) {
|
||||||
if (WaitTillCardIsFree(base))
|
if (WaitTillCardIsFree(base))
|
||||||
goto errrelfw;
|
goto errrelfw;
|
||||||
|
|
||||||
|
@ -1863,6 +1855,17 @@ static int __devinit load_firmware(struct pci_dev *pdev,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* xfer ctrl */
|
||||||
|
if (WaitTillCardIsFree(base))
|
||||||
|
goto errrelfw;
|
||||||
|
|
||||||
|
outw(0xf2, base);
|
||||||
|
outw(0x800, base);
|
||||||
|
outw(0x0, base);
|
||||||
|
outw(0x0, base);
|
||||||
|
InterruptTheCard(base);
|
||||||
|
outw(0x0, base + 0x4); /* for ISI4608 cards */
|
||||||
|
|
||||||
board->status |= FIRMWARE_LOADED;
|
board->status |= FIRMWARE_LOADED;
|
||||||
retval = 0;
|
retval = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue