-
Rolf Eike Beer authored
Am Donnerstag, 6. Mai 2004 02:48 schrieb Sy, Dely L: > On Fri, 30 Apr 2004 12:31:18 +0200, Rolf Eike Beer wrote: >> - >> -static int cleanup_slots (struct controller * ctrl) >> +static void cleanup_slots(const struct controller *ctrl) >> { >> - struct slot *old_slot, *next_slot; >> + struct slot *old_slot; >> >> old_slot = ctrl->slot; >> ctrl->slot = NULL; >> >> while (old_slot) { >> - next_slot = old_slot->next; >> - pci_hp_deregister (old_slot->hotplug_slot); >> - kfree(old_slot->hotplug_slot->info); >> - kfree(old_slot->hotplug_slot->name); >> - kfree(old_slot->hotplug_slot); >> - kfree(old_slot); >> - old_slot = next_slot; >> + pci_hp_deregister(old_slot->hotplug_slot); >> + old_slot = old_slot->next; >> } > > The variable next_slot and its assignment should be kept, for once > pci_hp_deregister() is called and the release callback function, which > you added, may come in and clean up old_slot structure before the next > ptr is saved. The code should be: > > static void cleanup_slots(const struct controller *ctrl) > { > struct slot *old_slot, *next_slot; > > old_slot = ctrl->slot; > ctrl->slot = NULL; > > while (old_slot) { > next_slot = old_slot->next; > pci_hp_deregister (old_slot->hotplug_slot); > old_slot = next_slot; > } > } Yes, good point. Greg, this patch makes does it. Please apply on top of the other stuff.
08c7b59b