Skip to content

Commit

Permalink
ACPI / memhotplug: free memory device if acpi_memory_enable_device() …
Browse files Browse the repository at this point in the history
…failed

If acpi_memory_enable_device() fails, acpi_memory_enable_device() will
return a non-zero value, which means we fail to bind the memory device to
this driver.  So we should free memory device before
acpi_memory_device_add() returns.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Reviewed-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Wen Congyang authored and Rafael J. Wysocki committed Nov 16, 2012
1 parent 386e52b commit e0b7b24
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/acpi/acpi_memhotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,9 +421,11 @@ static int acpi_memory_device_add(struct acpi_device *device)
if (!acpi_memory_check_device(mem_device)) {
/* call add_memory func */
result = acpi_memory_enable_device(mem_device);
if (result)
if (result) {
printk(KERN_ERR PREFIX
"Error in acpi_memory_enable_device\n");
acpi_memory_device_free(mem_device);
}
}
return result;
}
Expand Down

0 comments on commit e0b7b24

Please sign in to comment.