Commit 5f680f7a authored by Oliver Neukum's avatar Oliver Neukum Committed by Greg Kroah-Hartman

[PATCH] open/close fix for kaweth

this handles the error case.
parent 4caedfb4
...@@ -493,7 +493,7 @@ static void int_callback(struct urb *u) ...@@ -493,7 +493,7 @@ static void int_callback(struct urb *u)
/**************************************************************** /****************************************************************
* kaweth_resubmit_rx_urb * kaweth_resubmit_rx_urb
****************************************************************/ ****************************************************************/
static void kaweth_resubmit_rx_urb(struct kaweth_device *kaweth, static int kaweth_resubmit_rx_urb(struct kaweth_device *kaweth,
int mem_flags) int mem_flags)
{ {
int result; int result;
...@@ -513,6 +513,8 @@ static void kaweth_resubmit_rx_urb(struct kaweth_device *kaweth, ...@@ -513,6 +513,8 @@ static void kaweth_resubmit_rx_urb(struct kaweth_device *kaweth,
} else { } else {
kaweth->suspend_lowmem = 0; kaweth->suspend_lowmem = 0;
} }
return result;
} }
static void kaweth_async_set_rx_mode(struct kaweth_device *kaweth); static void kaweth_async_set_rx_mode(struct kaweth_device *kaweth);
...@@ -592,14 +594,15 @@ static void kaweth_usb_receive(struct urb *urb) ...@@ -592,14 +594,15 @@ static void kaweth_usb_receive(struct urb *urb)
static int kaweth_open(struct net_device *net) static int kaweth_open(struct net_device *net)
{ {
struct kaweth_device *kaweth = (struct kaweth_device *)net->priv; struct kaweth_device *kaweth = (struct kaweth_device *)net->priv;
int res;
kaweth_dbg("Dev usage: %d", kaweth->dev->refcnt.counter); kaweth_dbg("Dev usage: %d", kaweth->dev->refcnt.counter);
kaweth_dbg("Opening network device."); kaweth_dbg("Opening network device.");
MOD_INC_USE_COUNT; res = kaweth_resubmit_rx_urb(kaweth, GFP_KERNEL);
if (res)
kaweth_resubmit_rx_urb(kaweth, GFP_KERNEL); return -EIO;
FILL_INT_URB( FILL_INT_URB(
kaweth->irq_urb, kaweth->irq_urb,
...@@ -611,7 +614,11 @@ static int kaweth_open(struct net_device *net) ...@@ -611,7 +614,11 @@ static int kaweth_open(struct net_device *net)
kaweth, kaweth,
HZ/4); HZ/4);
usb_submit_urb(kaweth->irq_urb, GFP_KERNEL); res = usb_submit_urb(kaweth->irq_urb, GFP_KERNEL);
if (res) {
usb_unlink_urb(kaweth->rx_urb);
return -EIO;
}
netif_start_queue(net); netif_start_queue(net);
...@@ -635,7 +642,6 @@ static int kaweth_close(struct net_device *net) ...@@ -635,7 +642,6 @@ static int kaweth_close(struct net_device *net)
kaweth->status &= ~KAWETH_STATUS_CLOSING; kaweth->status &= ~KAWETH_STATUS_CLOSING;
MOD_DEC_USE_COUNT;
printk("Dev usage: %d", kaweth->dev->refcnt.counter); printk("Dev usage: %d", kaweth->dev->refcnt.counter);
......
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