ChangeSet 1.1587.12.18, 2004/04/29 15:51:27-07:00, eike-hotplug@sf-tec.de [PATCH] ACPI PCI Hotplug: use goto for error handling This one fixes another space before an opening brace I missed before and optimizes the error paths in init_slots a bit more. drivers/pci/hotplug/acpiphp_core.c | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-) diff -Nru a/drivers/pci/hotplug/acpiphp_core.c b/drivers/pci/hotplug/acpiphp_core.c --- a/drivers/pci/hotplug/acpiphp_core.c Mon May 17 17:05:43 2004 +++ b/drivers/pci/hotplug/acpiphp_core.c Mon May 17 17:05:43 2004 @@ -224,7 +224,7 @@ return 0; } -static int __init init_acpi (void) +static int __init init_acpi(void) { int retval; @@ -276,7 +276,7 @@ static int __init init_slots(void) { struct slot *slot; - int retval = 0; + int retval = -ENOMEM; int i; for (i = 0; i < num_slots; ++i) { @@ -318,8 +318,7 @@ retval = pci_hp_register(slot->hotplug_slot); if (retval) { err("pci_hp_register failed with error %d\n", retval); - release_slot(slot->hotplug_slot); - return retval; + goto error_name; } /* add slot to our internal list */ @@ -327,7 +326,9 @@ info("Slot [%s] registered\n", slot->hotplug_slot->name); } - return retval; + return 0; +error_name: + kfree(slot->hotplug_slot->name); error_info: kfree(slot->hotplug_slot->info); error_hpslot: @@ -335,7 +336,7 @@ error_slot: kfree(slot); error: - return -ENOMEM; + return retval; }