patch-1.3.22 linux/drivers/net/ppp.c

Next file: linux/drivers/pci/pci.c
Previous file: linux/drivers/net/net_init.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.21/linux/drivers/net/ppp.c linux/drivers/net/ppp.c
@@ -2117,12 +2117,20 @@
 init_module(void)
 {
 	int err;
-	int i;
+	int i,j;
 
 	for (i = 0; i < PPP_NRUNIT; i++)  {
 		if ((err = register_netdev(&dev_ppp[i])))  {
 			if (err == -EEXIST)  {
 				printk("PPP: devices already present. Module not loaded.\n");
+				/* we must unregister already registered units */
+				if(i>0) {
+					for(j = 0; j < i ; j++)
+						unregister_netdev(&dev_ppp[j]);
+					if ((j = tty_register_ldisc(N_PPP, NULL)))  {
+						printk("PPP: can't unregister line discipline (err = %d)\n", j);
+					}
+				}
 			}
 			return err;
 		}

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this