From: Piotr Haber Date: Thu, 11 Oct 2012 12:05:15 +0000 (+0200) Subject: bcma: fix unregistration of cores X-Git-Tag: v3.7-rc3~7^2^2~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1fffa905adffbf0d3767fc978ef09afb830275eb;p=platform%2Fkernel%2Flinux-exynos.git bcma: fix unregistration of cores When cores are unregistered, entries need to be removed from cores list in a safe manner. Reported-by: Stanislaw Gruszka Reviewed-by: Arend Van Spriel Signed-off-by: Piotr Haber Cc: stable@vger.kernel.org Signed-off-by: John W. Linville --- diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c index 432aeee..d865470 100644 --- a/drivers/bcma/main.c +++ b/drivers/bcma/main.c @@ -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); }