diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c index 074bbdb67f0e..b651e42161e6 100644 --- a/drivers/w1/w1.c +++ b/drivers/w1/w1.c @@ -1253,10 +1253,10 @@ static int __init w1_init(void) static void __exit w1_fini(void) { - struct w1_master *dev; + struct w1_master *dev, *n; /* Set netlink removal messages and some cleanup */ - list_for_each_entry(dev, &w1_masters, w1_master_entry) + list_for_each_entry_safe(dev, n, &w1_masters, w1_master_entry) __w1_remove_master_device(dev); w1_fini_netlink();