Skip to contentSkip to conversation

fixes to kaweth in response to Umap2 testing

PATCH In review Oliver Neukum 3 participants 4 messages Aug 17, 2016 – Aug 19, 2016 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#2 lore raw

PATCH v2 1/2 kaweth: fix firmware download

In reply to a message not in the archive

This fixes the oops discovered by the Umap2 project and Alan Stern. The intf member needs to be set before the firmware is downloaded.

---
 drivers/net/usb/kaweth.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/usb/kaweth.c +1 -1
index 770212b..37bf715 100644
@@ -1029,6 +1029,7 @@ static int kaweth_probe(
 	kaweth = netdev_priv(netdev);
 	kaweth->dev = udev;
 	kaweth->net = netdev;
+	kaweth->intf = intf;
 
 	spin_lock_init(&kaweth->device_lock);
 	init_waitqueue_head(&kaweth->term_wait);
@@ -1139,8 +1140,6 @@ err_fw:
 
 	dev_dbg(dev, "Initializing net device.\n");
 
-	kaweth->intf = intf;
#0 lore raw

v2 cover fixes to kaweth in response to Umap2 testing

These patches fix an oops in firmware downloading and an oops due to a memory allocation failure

#3 lore raw

PATCH v2 2/2 kaweth: fix oops upon failed memory allocation

Just return an error upon failure.

---
 drivers/net/usb/kaweth.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/usb/kaweth.c +6 -1
index 37bf715..528b9c9 100644
@@ -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,
@@ -1203,7 +1208,7 @@ err_only_tx:
 err_free_netdev:
 	free_netdev(netdev);
 
-	return -EIO;
+	return rv;
 }
 
 /****************************************************************
Signature · 1 line
2.1.4