summaryrefslogtreecommitdiff
path: root/drivers/net/spider_net.c
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2006-01-12 17:16:41 -0500
committerJeff Garzik <jgarzik@pobox.com>2006-01-17 07:25:00 -0500
commit0d3ea1666f1894a874681fe33e2cb7fee41a0c73 (patch)
tree6a206ebf46fe622ae6d06923c92b8a737f63ce86 /drivers/net/spider_net.c
parentc2e5b352fcefb644959a0c8b1bb2e297f0d4ac3d (diff)
[PATCH] spidernet: check if firmware was loaded correctly
Uploading the device firmware may fail if wrong input data was provided by the user. This checks for the condition. From: Jens Osterkamp <Jens.Osterkamp@de.ibm.com> Signed-off-by: Jens Osterkamp <Jens.Osterkamp@de.ibm.com> Signed-off-by: Arnd Bergmann <arndb@de.ibm.com> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/net/spider_net.c')
-rw-r--r--drivers/net/spider_net.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c
index 0d765f1733b5..2154469678b7 100644
--- a/drivers/net/spider_net.c
+++ b/drivers/net/spider_net.c
@@ -1836,7 +1836,7 @@ spider_net_setup_phy(struct spider_net_card *card)
* spider_net_download_firmware loads the firmware opened by
* spider_net_init_firmware into the adapter.
*/
-static void
+static int
spider_net_download_firmware(struct spider_net_card *card,
const struct firmware *firmware)
{
@@ -1857,8 +1857,13 @@ spider_net_download_firmware(struct spider_net_card *card,
}
}
+ if (spider_net_read_reg(card, SPIDER_NET_GSINIT))
+ return -EIO;
+
spider_net_write_reg(card, SPIDER_NET_GSINIT,
SPIDER_NET_RUN_SEQ_VALUE);
+
+ return 0;
}
/**
@@ -1909,9 +1914,8 @@ spider_net_init_firmware(struct spider_net_card *card)
goto out;
}
- spider_net_download_firmware(card, firmware);
-
- err = 0;
+ if (!spider_net_download_firmware(card, firmware))
+ err = 0;
out:
release_firmware(firmware);