aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/myri10ge/myri10ge.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/myri10ge/myri10ge.c')
-rw-r--r--drivers/net/myri10ge/myri10ge.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index e0d76c75aea0..823bb6d35334 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)
529 unsigned crc, reread_crc; 529 unsigned crc, reread_crc;
530 const struct firmware *fw; 530 const struct firmware *fw;
531 struct device *dev = &mgp->pdev->dev; 531 struct device *dev = &mgp->pdev->dev;
532 unsigned char *fw_readback;
532 struct mcp_gen_header *hdr; 533 struct mcp_gen_header *hdr;
533 size_t hdr_offset; 534 size_t hdr_offset;
534 int status; 535 int status;
@@ -571,9 +572,15 @@ static int myri10ge_load_hotplug_firmware(struct myri10ge_priv *mgp, u32 * size)
571 mb(); 572 mb();
572 readb(mgp->sram); 573 readb(mgp->sram);
573 } 574 }
575 fw_readback = vmalloc(fw->size);
576 if (!fw_readback) {
577 status = -ENOMEM;
578 goto abort_with_fw;
579 }
574 /* corruption checking is good for parity recovery and buggy chipset */ 580 /* corruption checking is good for parity recovery and buggy chipset */
575 memcpy_fromio(fw->data, mgp->sram + MYRI10GE_FW_OFFSET, fw->size); 581 memcpy_fromio(fw_readback, mgp->sram + MYRI10GE_FW_OFFSET, fw->size);
576 reread_crc = crc32(~0, fw->data, fw->size); 582 reread_crc = crc32(~0, fw_readback, fw->size);
583 vfree(fw_readback);
577 if (crc != reread_crc) { 584 if (crc != reread_crc) {
578 dev_err(dev, "CRC failed(fw-len=%u), got 0x%x (expect 0x%x)\n", 585 dev_err(dev, "CRC failed(fw-len=%u), got 0x%x (expect 0x%x)\n",
579 (unsigned)fw->size, reread_crc, crc); 586 (unsigned)fw->size, reread_crc, crc);