bcma: fix unregistration of cores
authorPiotr Haber <phaber@broadcom.com>
Thu, 11 Oct 2012 12:05:15 +0000 (14:05 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 15 Oct 2012 18:45:51 +0000 (14:45 -0400)
When cores are unregistered, entries
need to be removed from cores list in a safe manner.

Reported-by: Stanislaw Gruszka <sgruszka@redhat.com>
Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Signed-off-by: Piotr Haber <phaber@broadcom.com>
Cc: stable@vger.kernel.org
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/bcma/main.c

index 432aeeedfd5e6992c28ea081e4185bf88ffeed8e..d865470bc9511a12f3c4370dd12bf22c28fc2cf0 100644 (file)
@@ -158,9 +158,10 @@ static int bcma_register_cores(struct bcma_bus *bus)
 
 static void bcma_unregister_cores(struct bcma_bus *bus)
 {
-       struct bcma_device *core;
+       struct bcma_device *core, *tmp;
 
-       list_for_each_entry(core, &bus->cores, list) {
+       list_for_each_entry_safe(core, tmp, &bus->cores, list) {
+               list_del(&core->list);
                if (core->dev_registered)
                        device_unregister(&core->dev);
        }