Skip to content

Commit

Permalink
[PATCH] spidernet: check if firmware was loaded correctly
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Arnd Bergmann authored and Jeff Garzik committed Jan 17, 2006
1 parent c2e5b35 commit 0d3ea16
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions drivers/net/spider_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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;
}

/**
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 0d3ea16

Please sign in to comment.