From: Jiri Slaby Date: Sun, 1 Oct 2006 06:27:50 +0000 (-0700) Subject: [PATCH] isicom: correct firmware loading X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e4e040887b8f136d00e253dcf584667d8cd560a6;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git [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 Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c index 913be23e0a24..2e1da632aee1 100644 --- a/drivers/char/isicom.c +++ b/drivers/char/isicom.c @@ -1756,9 +1756,12 @@ static int __devinit load_firmware(struct pci_dev *pdev, if (retval) goto end; + retval = -EIO; + for (frame = (struct stframe *)fw->data; frame < (struct stframe *)(fw->data + fw->size); - frame++) { + frame = (struct stframe *)((u8 *)(frame + 1) + + frame->count)) { if (WaitTillCardIsFree(base)) 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 * in load firmware package? */ - for (frame = (struct stframe*)fw->data; - frame < (struct stframe*)(fw->data + fw->size); - frame++) { + for (frame = (struct stframe *)fw->data; + frame < (struct stframe *)(fw->data + fw->size); + frame = (struct stframe *)((u8 *)(frame + 1) + + frame->count)) { if (WaitTillCardIsFree(base)) 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; retval = 0;