# This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.652 -> 1.653 # drivers/usb/net/kaweth.c 1.24 -> 1.25 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 02/09/11 oliver@neukum.name 1.653 # [PATCH] open/close fix for kaweth # # this handles the error case. # -------------------------------------------- # diff -Nru a/drivers/usb/net/kaweth.c b/drivers/usb/net/kaweth.c --- a/drivers/usb/net/kaweth.c Thu Sep 12 10:25:54 2002 +++ b/drivers/usb/net/kaweth.c Thu Sep 12 10:25:54 2002 @@ -493,7 +493,7 @@ /**************************************************************** * 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 result; @@ -513,6 +513,8 @@ } else { kaweth->suspend_lowmem = 0; } + + return result; } static void kaweth_async_set_rx_mode(struct kaweth_device *kaweth); @@ -592,14 +594,15 @@ static int kaweth_open(struct net_device *net) { struct kaweth_device *kaweth = (struct kaweth_device *)net->priv; + int res; kaweth_dbg("Dev usage: %d", kaweth->dev->refcnt.counter); kaweth_dbg("Opening network device."); - MOD_INC_USE_COUNT; - - kaweth_resubmit_rx_urb(kaweth, GFP_KERNEL); + res = kaweth_resubmit_rx_urb(kaweth, GFP_KERNEL); + if (res) + return -EIO; FILL_INT_URB( kaweth->irq_urb, @@ -611,7 +614,11 @@ kaweth, 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); @@ -635,7 +642,6 @@ kaweth->status &= ~KAWETH_STATUS_CLOSING; - MOD_DEC_USE_COUNT; printk("Dev usage: %d", kaweth->dev->refcnt.counter);