aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2006-10-01 02:27:50 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-01 03:39:22 -0400
commite4e040887b8f136d00e253dcf584667d8cd560a6 (patch)
tree70672802a7ace7663f6d785845a30418ee3ff305 /drivers
parent3f27100872b21e4cc70d07b96eeb3611b30bce63 (diff)
[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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/isicom.c35
1 files changed, 19 insertions, 16 deletions
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,
1756 if (retval) 1756 if (retval)
1757 goto end; 1757 goto end;
1758 1758
1759 retval = -EIO;
1760
1759 for (frame = (struct stframe *)fw->data; 1761 for (frame = (struct stframe *)fw->data;
1760 frame < (struct stframe *)(fw->data + fw->size); 1762 frame < (struct stframe *)(fw->data + fw->size);
1761 frame++) { 1763 frame = (struct stframe *)((u8 *)(frame + 1) +
1764 frame->count)) {
1762 if (WaitTillCardIsFree(base)) 1765 if (WaitTillCardIsFree(base))
1763 goto errrelfw; 1766 goto errrelfw;
1764 1767
@@ -1797,23 +1800,12 @@ static int __devinit load_firmware(struct pci_dev *pdev,
1797 } 1800 }
1798 } 1801 }
1799 1802
1800 retval = -EIO;
1801
1802 if (WaitTillCardIsFree(base))
1803 goto errrelfw;
1804
1805 outw(0xf2, base);
1806 outw(0x800, base);
1807 outw(0x0, base);
1808 outw(0x0, base);
1809 InterruptTheCard(base);
1810 outw(0x0, base + 0x4); /* for ISI4608 cards */
1811
1812/* XXX: should we test it by reading it back and comparing with original like 1803/* XXX: should we test it by reading it back and comparing with original like
1813 * in load firmware package? */ 1804 * in load firmware package? */
1814 for (frame = (struct stframe*)fw->data; 1805 for (frame = (struct stframe *)fw->data;
1815 frame < (struct stframe*)(fw->data + fw->size); 1806 frame < (struct stframe *)(fw->data + fw->size);
1816 frame++) { 1807 frame = (struct stframe *)((u8 *)(frame + 1) +
1808 frame->count)) {
1817 if (WaitTillCardIsFree(base)) 1809 if (WaitTillCardIsFree(base))
1818 goto errrelfw; 1810 goto errrelfw;
1819 1811
@@ -1863,6 +1855,17 @@ static int __devinit load_firmware(struct pci_dev *pdev,
1863 } 1855 }
1864 } 1856 }
1865 1857
1858 /* xfer ctrl */
1859 if (WaitTillCardIsFree(base))
1860 goto errrelfw;
1861
1862 outw(0xf2, base);
1863 outw(0x800, base);
1864 outw(0x0, base);
1865 outw(0x0, base);
1866 InterruptTheCard(base);
1867 outw(0x0, base + 0x4); /* for ISI4608 cards */
1868
1866 board->status |= FIRMWARE_LOADED; 1869 board->status |= FIRMWARE_LOADED;
1867 retval = 0; 1870 retval = 0;
1868 1871