Skip to content

Commit

Permalink
kaweth: fix oops upon failed memory allocation
Browse files Browse the repository at this point in the history
Just return an error upon failure.

Signed-off-by: Oliver Neukum <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
oneukum authored and davem330 committed Aug 19, 2016
1 parent 60bcabd commit 575ced7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/net/usb/kaweth.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -1203,7 +1208,7 @@ static int kaweth_probe(
err_free_netdev:
free_netdev(netdev);

return -EIO;
return rv;
}

/****************************************************************
Expand Down

0 comments on commit 575ced7

Please sign in to comment.