Commit 1fffa905adffbf0d3767fc978ef09afb830275eb

Authored by Piotr Haber
Committed by John W. Linville
1 parent d4fa14cd62

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 <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>

Showing 1 changed file with 3 additions and 2 deletions Side-by-side Diff

... ... @@ -158,9 +158,10 @@
158 158  
159 159 static void bcma_unregister_cores(struct bcma_bus *bus)
160 160 {
161   - struct bcma_device *core;
  161 + struct bcma_device *core, *tmp;
162 162  
163   - list_for_each_entry(core, &bus->cores, list) {
  163 + list_for_each_entry_safe(core, tmp, &bus->cores, list) {
  164 + list_del(&core->list);
164 165 if (core->dev_registered)
165 166 device_unregister(&core->dev);
166 167 }