Commit 51c59514 authored by Rolf Eike Beer's avatar Rolf Eike Beer Committed by Deepak Saxena

[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.
parent ae177142
...@@ -224,7 +224,7 @@ static int get_address(struct hotplug_slot *hotplug_slot, u32 *value) ...@@ -224,7 +224,7 @@ static int get_address(struct hotplug_slot *hotplug_slot, u32 *value)
return 0; return 0;
} }
static int __init init_acpi (void) static int __init init_acpi(void)
{ {
int retval; int retval;
...@@ -276,7 +276,7 @@ static void release_slot(struct hotplug_slot *hotplug_slot) ...@@ -276,7 +276,7 @@ static void release_slot(struct hotplug_slot *hotplug_slot)
static int __init init_slots(void) static int __init init_slots(void)
{ {
struct slot *slot; struct slot *slot;
int retval = 0; int retval = -ENOMEM;
int i; int i;
for (i = 0; i < num_slots; ++i) { for (i = 0; i < num_slots; ++i) {
...@@ -318,8 +318,7 @@ static int __init init_slots(void) ...@@ -318,8 +318,7 @@ static int __init init_slots(void)
retval = pci_hp_register(slot->hotplug_slot); retval = pci_hp_register(slot->hotplug_slot);
if (retval) { if (retval) {
err("pci_hp_register failed with error %d\n", retval); err("pci_hp_register failed with error %d\n", retval);
release_slot(slot->hotplug_slot); goto error_name;
return retval;
} }
/* add slot to our internal list */ /* add slot to our internal list */
...@@ -327,7 +326,9 @@ static int __init init_slots(void) ...@@ -327,7 +326,9 @@ static int __init init_slots(void)
info("Slot [%s] registered\n", slot->hotplug_slot->name); info("Slot [%s] registered\n", slot->hotplug_slot->name);
} }
return retval; return 0;
error_name:
kfree(slot->hotplug_slot->name);
error_info: error_info:
kfree(slot->hotplug_slot->info); kfree(slot->hotplug_slot->info);
error_hpslot: error_hpslot:
...@@ -335,7 +336,7 @@ static int __init init_slots(void) ...@@ -335,7 +336,7 @@ static int __init init_slots(void)
error_slot: error_slot:
kfree(slot); kfree(slot);
error: error:
return -ENOMEM; return retval;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment