kaweth: fix oops upon failed memory allocation
Just return an error upon failure. Signed-off-by: Oliver Neukum <oneukum@suse.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
60bcabd080
commit
575ced7f80
@ -1009,6 +1009,7 @@ static int kaweth_probe(
|
|||||||
struct net_device *netdev;
|
struct net_device *netdev;
|
||||||
const eth_addr_t bcast_addr = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
|
const eth_addr_t bcast_addr = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
int rv = -EIO;
|
||||||
|
|
||||||
dev_dbg(dev,
|
dev_dbg(dev,
|
||||||
"Kawasaki Device Probe (Device number:%d): 0x%4.4x:0x%4.4x:0x%4.4x\n",
|
"Kawasaki Device Probe (Device number:%d): 0x%4.4x:0x%4.4x:0x%4.4x\n",
|
||||||
@ -1049,6 +1050,10 @@ static int kaweth_probe(
|
|||||||
/* Download the firmware */
|
/* Download the firmware */
|
||||||
dev_info(dev, "Downloading firmware...\n");
|
dev_info(dev, "Downloading firmware...\n");
|
||||||
kaweth->firmware_buf = (__u8 *)__get_free_page(GFP_KERNEL);
|
kaweth->firmware_buf = (__u8 *)__get_free_page(GFP_KERNEL);
|
||||||
|
if (!kaweth->firmware_buf) {
|
||||||
|
rv = -ENOMEM;
|
||||||
|
goto err_free_netdev;
|
||||||
|
}
|
||||||
if ((result = kaweth_download_firmware(kaweth,
|
if ((result = kaweth_download_firmware(kaweth,
|
||||||
"kaweth/new_code.bin",
|
"kaweth/new_code.bin",
|
||||||
100,
|
100,
|
||||||
@ -1203,7 +1208,7 @@ err_only_tx:
|
|||||||
err_free_netdev:
|
err_free_netdev:
|
||||||
free_netdev(netdev);
|
free_netdev(netdev);
|
||||||
|
|
||||||
return -EIO;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************
|
/****************************************************************
|
||||||
|
Loading…
Reference in New Issue
Block a user