netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] CDC NCM: release interfaces fix in unbind()
@ 2011-05-15 20:28 Alexey Orishko
  2011-05-16 19:13 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Alexey Orishko @ 2011-05-15 20:28 UTC (permalink / raw)
  To: netdev; +Cc: linux-usb, davem, gregkh, oliver, Alexey Orishko

Signed-off-by: Alexey Orishko <alexey.orishko@stericsson.com>
---
 drivers/net/usb/cdc_ncm.c |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 4ab557d..500b1a6 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -54,7 +54,7 @@
 #include <linux/usb/usbnet.h>
 #include <linux/usb/cdc.h>
 
-#define	DRIVER_VERSION				"06-May-2011"
+#define	DRIVER_VERSION				"15-May-2011"
 
 /* CDC NCM subclass 3.2.1 */
 #define USB_CDC_NCM_NDP16_LENGTH_MIN		0x10
@@ -652,28 +652,25 @@ error:
 static void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf)
 {
 	struct cdc_ncm_ctx *ctx = (struct cdc_ncm_ctx *)dev->data[0];
-	struct usb_driver *driver;
+	struct usb_driver *driver = driver_of(intf);
 
 	if (ctx == NULL)
 		return;		/* no setup */
 
-	driver = driver_of(intf);
-
-	usb_set_intfdata(ctx->data, NULL);
-	usb_set_intfdata(ctx->control, NULL);
-	usb_set_intfdata(ctx->intf, NULL);
-
 	/* release interfaces, if any */
 	if (ctx->data_claimed) {
+		usb_set_intfdata(ctx->data, NULL);
 		usb_driver_release_interface(driver, ctx->data);
 		ctx->data_claimed = 0;
 	}
 
 	if (ctx->control_claimed) {
+		usb_set_intfdata(ctx->control, NULL);
 		usb_driver_release_interface(driver, ctx->control);
 		ctx->control_claimed = 0;
 	}
 
+	usb_set_intfdata(ctx->intf, NULL);
 	cdc_ncm_free(ctx);
 }
 
-- 
1.7.4.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-05-17  6:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-15 20:28 [PATCH] CDC NCM: release interfaces fix in unbind() Alexey Orishko
2011-05-16 19:13 ` David Miller
     [not found]   ` <20110516.151302.89070822321885499.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2011-05-17  0:52     ` Alexey ORISHKO
     [not found]       ` <2AC7D4AD8BA1C640B4C60C61C8E520153E3A93E8EE-8ZTw5gFVCTjVH5byLeRTJxkTb7+GphCuwzqs5ZKRSiY@public.gmane.org>
2011-05-17  6:26         ` Oliver Neukum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).