]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
ACPI / hotplug / PCI: Simplify register_slot()
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 3 Feb 2014 23:38:15 +0000 (00:38 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 5 Feb 2014 16:40:32 +0000 (17:40 +0100)
The err label in register_slot() is only jumped to from one place,
so move the code under the label to that place and drop the label.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
drivers/pci/hotplug/acpiphp_glue.c

index 4bc716b2bbaa754dc3ba785ab0044a07bb473b3c..c97454c74c26ed77bdfd69040d724c3ddf18e0bb 100644 (file)
@@ -335,8 +335,10 @@ static acpi_status register_slot(acpi_handle handle, u32 lvl, void *data,
 
        slot = kzalloc(sizeof(struct acpiphp_slot), GFP_KERNEL);
        if (!slot) {
-               status = AE_NO_MEMORY;
-               goto err;
+               mutex_lock(&acpiphp_context_lock);
+               acpiphp_put_context(context);
+               mutex_unlock(&acpiphp_context_lock);
+               return AE_NO_MEMORY;
        }
 
        slot->bus = bridge->pci_bus;
@@ -404,12 +406,6 @@ static acpi_status register_slot(acpi_handle handle, u32 lvl, void *data,
        }
 
        return AE_OK;
-
- err:
-       mutex_lock(&acpiphp_context_lock);
-       acpiphp_put_context(context);
-       mutex_unlock(&acpiphp_context_lock);
-       return status;
 }
 
 static struct acpiphp_bridge *acpiphp_handle_to_bridge(acpi_handle handle)