[PATCH -repost] isicom: correct firmware loading

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 it's data contents --
bad idea. Tell the card we're ready just after checking is complete, not before.

Signed-off-by: Jiri Slaby <[email protected]>

---
commit 7fa7a3e6bcd181bb25adacfc71dc8a386e347e9d
tree 00758e71b46c5de09d98c79cf00f187012b9ba35
parent ca8b00296c6ff25faf9db7fe4b11d1460b64c7d7
author Jiri Slaby <[email protected]> Mon, 18 Sep 2006 22:57:06 +0200
committer Jiri Slaby <[email protected]> Mon, 18 Sep 2006 22:57:06 +0200

 drivers/char/isicom.c |   35 +++++++++++++++++++----------------
 1 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c
index 6cca4b2..ea2bbf8 100644
--- a/drivers/char/isicom.c
+++ b/drivers/char/isicom.c
@@ -1756,9 +1756,12 @@ static int __devinit load_firmware(struc
 	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(struc
 		}
  	}
 
-	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(struc
 		}
 	}
 
+	/* 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;
 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux