patch-2.3.99-pre7 linux/drivers/usb/plusb.c

Next file: linux/drivers/usb/scanner.c
Previous file: linux/drivers/usb/pegasus.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.99-pre6/linux/drivers/usb/plusb.c linux/drivers/usb/plusb.c
@@ -465,8 +465,7 @@
 	if(!s->opened && s->net_dev.name) {
 		dbg("unregistering netdev: %s",s->net_dev.name);
 		unregister_netdev(&s->net_dev);
-		kfree(s->net_dev.name);
-		s->net_dev.name=NULL;
+		s->net_dev.name[0] = '\0';
 	}
 	
 	dbg("plusb_disconnect: finished");
@@ -524,22 +523,15 @@
 		return NULL;
 	}
 
-	if(!s->net_dev.name) {
-		s->net_dev.name=kmalloc(16, GFP_KERNEL);
-
-		if(!s->net_dev.name || dev_alloc_name(&s->net_dev,"plusb%d")<0)	{
-			err("alloc name failed\n");
-			return NULL;
-		}
-
+	if(!s->net_dev.name[0]) {
+		strcpy(s->net_dev.name, "plusb%d");
 		s->net_dev.init=plusb_net_init;
 		s->net_dev.priv=s;
 		if(!register_netdev(&s->net_dev))
 			info("registered: %s", s->net_dev.name);
 		else {
 			err("register_netdev failed");
-			kfree(s->net_dev.name);
-			s->net_dev.name=NULL;
+			s->net_dev.name[0] = '\0';
 		}
 	}
 		
@@ -598,11 +590,9 @@
 	dbg("plusb_cleanup");
 	for (u = 0; u < NRPLUSB; u++) {
 		plusb_t *s = &plusb[u];
-		if(s->net_dev.name) {
+		if(s->net_dev.name[0]) {
 			dbg("unregistering netdev: %s",s->net_dev.name);
 			unregister_netdev(&s->net_dev);
-			kfree(s->net_dev.name);
-			s->net_dev.name=NULL;
 		}
 	}
 	usb_deregister (&plusb_driver);

FUNET's LINUX-ADM group, [email protected]
TCL-scripts by Sam Shen (who was at: [email protected])