From: Wen Congyang Date: Tue, 14 Aug 2012 03:22:24 +0000 (+1000) Subject: acpi_memhotplug.c: free memory device if acpi_memory_enable_device() failed X-Git-Tag: next-20120824~2^2~60 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=619f8a70784e1bc42ac100e1a1378530c02ee48b;p=karo-tx-linux.git acpi_memhotplug.c: 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 Cc: Len Brown Cc: "Brown, Len" Cc: Yasuaki ISIMATU Cc: David Rientjes Cc: Konrad Rzeszutek Wilk Signed-off-by: Andrew Morton --- diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index 62c2c74b5d9a..d97bb952a426 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c @@ -478,9 +478,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; }