Message ID | 1352372693-32411-5-git-send-email-wency@cn.fujitsu.com (mailing list archive) |
---|---|
State | Superseded, archived |
Headers | show |
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index 5e5ac80..8914399 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c @@ -506,9 +506,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; }
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. CC: David Rientjes <rientjes@google.com> CC: Jiang Liu <liuj97@gmail.com> CC: Len Brown <len.brown@intel.com> CC: Benjamin Herrenschmidt <benh@kernel.crashing.org> CC: Paul Mackerras <paulus@samba.org> CC: Christoph Lameter <cl@linux.com> Cc: Minchan Kim <minchan.kim@gmail.com> CC: Andrew Morton <akpm@linux-foundation.org> CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> CC: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com> CC: Rafael J. Wysocki <rjw@sisk.pl> CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Signed-off-by: Wen Congyang <wency@cn.fujitsu.com> --- drivers/acpi/acpi_memhotplug.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)