diff options
author | David Woodhouse <dwmw2@infradead.org> | 2008-05-23 23:00:07 (GMT) |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2008-07-10 13:26:04 (GMT) |
commit | b0d31d6b28c7ca2ed78ce16ec649c0aac383a3fe (patch) | |
tree | f36544d409c95b0bf3fb7292f4a8f00c134d87eb /drivers/net | |
parent | 9ad46a6ac5422882d9f9a7f0d77ca0766f56bb6e (diff) | |
download | linux-b0d31d6b28c7ca2ed78ce16ec649c0aac383a3fe.tar.xz |
myri10ge: treat firmware data as const
... which means allocating our own buffer for reading it back.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/myri10ge/myri10ge.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c index e0d76c7..823bb6d 100644 --- a/drivers/net/myri10ge/myri10ge.c +++ b/drivers/net/myri10ge/myri10ge.c @@ -529,6 +529,7 @@ static int myri10ge_load_hotplug_firmware(struct myri10ge_priv *mgp, u32 * size) unsigned crc, reread_crc; const struct firmware *fw; struct device *dev = &mgp->pdev->dev; + unsigned char *fw_readback; struct mcp_gen_header *hdr; size_t hdr_offset; int status; @@ -571,9 +572,15 @@ static int myri10ge_load_hotplug_firmware(struct myri10ge_priv *mgp, u32 * size) mb(); readb(mgp->sram); } + fw_readback = vmalloc(fw->size); + if (!fw_readback) { + status = -ENOMEM; + goto abort_with_fw; + } /* corruption checking is good for parity recovery and buggy chipset */ - memcpy_fromio(fw->data, mgp->sram + MYRI10GE_FW_OFFSET, fw->size); - reread_crc = crc32(~0, fw->data, fw->size); + memcpy_fromio(fw_readback, mgp->sram + MYRI10GE_FW_OFFSET, fw->size); + reread_crc = crc32(~0, fw_readback, fw->size); + vfree(fw_readback); if (crc != reread_crc) { dev_err(dev, "CRC failed(fw-len=%u), got 0x%x (expect 0x%x)\n", (unsigned)fw->size, reread_crc, crc); |