patch-2.4.6 linux/drivers/net/wan/lapbether.c

Next file: linux/drivers/net/wan/lmc/lmc_main.c
Previous file: linux/drivers/net/wan/hdlc.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.5/linux/drivers/net/wan/lapbether.c linux/drivers/net/wan/lapbether.c
@@ -89,7 +89,7 @@
  */
 static int lapbeth_check_devices(struct net_device *dev)
 {
-	struct lapbethdev *lapbeth, *lapbeth_prev;
+	struct lapbethdev *lapbeth, *lapbeth_prev, *lapbeth_next;
 	int result = 0;
 	unsigned long flags;
 
@@ -98,7 +98,8 @@
 
 	lapbeth_prev = NULL;
 
-	for (lapbeth = lapbeth_devices; lapbeth != NULL; lapbeth = lapbeth->next) {
+	for (lapbeth = lapbeth_devices; lapbeth != NULL; lapbeth = lapbeth_next) {
+		lapbeth_next = lapbeth->next;
 		if (!dev_get(lapbeth->ethname)) {
 			if (lapbeth_prev)
 				lapbeth_prev->next = lapbeth->next;
@@ -112,8 +113,8 @@
 			dev_put(lapbeth->ethdev);
 			kfree(lapbeth);
 		}
-
-		lapbeth_prev = lapbeth;
+		else
+			lapbeth_prev = lapbeth;
 	}
 
 	restore_flags(flags);

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