From: Wen Congyang Date: Fri, 16 Nov 2012 01:08:16 +0000 (+0100) Subject: ACPI / memhotplug: free memory device if acpi_memory_enable_device() failed X-Git-Tag: v3.12-rc1~1849^2~1^2~21 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e0b7b24dd9559fcda0f8bfd6acbcad81682c4fdd;p=kernel%2Fkernel-generic.git 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 Reviewed-by: Yasuaki Ishimatsu Acked-by: David Rientjes Signed-off-by: Rafael J. Wysocki --- diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index c5e7b6d0..e52ad5d 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) 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; }