Commit 88c03bd0 authored by Oliver Neukum's avatar Oliver Neukum Committed by Greg Kroah-Hartman

kaweth: fix oops upon failed memory allocation

commit 575ced7f upstream.

Just return an error upon failure.
Signed-off-by: default avatarOliver Neukum <oneukum@suse.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarAmit Pundir <amit.pundir@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 34d28e0e
......@@ -1009,6 +1009,7 @@ static int kaweth_probe(
struct net_device *netdev;
const eth_addr_t bcast_addr = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
int result = 0;
int rv = -EIO;
dev_dbg(dev,
"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 */
dev_info(dev, "Downloading firmware...\n");
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,
"kaweth/new_code.bin",
100,
......@@ -1209,7 +1214,7 @@ static int kaweth_probe(
err_free_netdev:
free_netdev(netdev);
return -EIO;
return rv;
}
/****************************************************************
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment