aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWen Congyang <wency@cn.fujitsu.com>2012-11-15 20:08:16 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2012-11-15 20:08:16 -0500
commite0b7b24dd9559fcda0f8bfd6acbcad81682c4fdd (patch)
treec65d30553948fbd64cda945b1a8eaf4a45dd064c
parent386e52b95550db87c93455e3c0efe3cc4543f036 (diff)
ACPI / memhotplug: free memory device if acpi_memory_enable_device() 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>
-rw-r--r--drivers/acpi/acpi_memhotplug.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c
index c5e7b6d08ef3..e52ad5d3792d 100644
--- a/drivers/acpi/acpi_memhotplug.c
+++ b/drivers/acpi/acpi_memhotplug.c
@@ -421,9 +421,11 @@ static int acpi_memory_device_add(struct acpi_device *device)
421 if (!acpi_memory_check_device(mem_device)) { 421 if (!acpi_memory_check_device(mem_device)) {
422 /* call add_memory func */ 422 /* call add_memory func */
423 result = acpi_memory_enable_device(mem_device); 423 result = acpi_memory_enable_device(mem_device);
424 if (result) 424 if (result) {
425 printk(KERN_ERR PREFIX 425 printk(KERN_ERR PREFIX
426 "Error in acpi_memory_enable_device\n"); 426 "Error in acpi_memory_enable_device\n");
427 acpi_memory_device_free(mem_device);
428 }
427 } 429 }
428 return result; 430 return result;
429} 431}