patch-2.4.10 linux/drivers/net/net_init.c

Next file: linux/drivers/net/ni5010.c
Previous file: linux/drivers/net/ncr885e.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.9/linux/drivers/net/net_init.c linux/drivers/net/net_init.c
@@ -165,9 +165,16 @@
 	setup(dev);
 	
 	if (new_device) {
+		int err;
+
 		rtnl_lock();
-		register_netdevice(dev);
+		err = register_netdevice(dev);
 		rtnl_unlock();
+
+		if (err < 0) {
+			kfree(dev);
+			dev = NULL;
+		}
 	}
 	return dev;
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)