[PATCH] memory hotadd fixes: avoid registering res twice

both of acpi_memory_enable_device() and acpi_memory_add_device() may evaluate
_CRS method.

We should avoid evaluate device's resource twice if we could get it
successfully in past.

Signed-off-by: KAMEZWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Keith Mannthey <kmannth@gmail.com>
Cc: Yasunori Goto <y-goto@jp.fujitsu.com>
Cc: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by KAMEZAWA Hiroyuki and committed by Linus Torvalds 5d2870fa fa25d8d6

+4
+4
drivers/acpi/acpi_memhotplug.c
··· 129 struct acpi_memory_info *info, *n; 130 131 132 status = acpi_walk_resources(mem_device->device->handle, METHOD_NAME__CRS, 133 acpi_memory_get_resource, mem_device); 134 if (ACPI_FAILURE(status)) { 135 list_for_each_entry_safe(info, n, &mem_device->res_list, list) 136 kfree(info); 137 return -EINVAL; 138 } 139
··· 129 struct acpi_memory_info *info, *n; 130 131 132 + if (!list_empty(&mem_device->res_list)) 133 + return 0; 134 + 135 status = acpi_walk_resources(mem_device->device->handle, METHOD_NAME__CRS, 136 acpi_memory_get_resource, mem_device); 137 if (ACPI_FAILURE(status)) { 138 list_for_each_entry_safe(info, n, &mem_device->res_list, list) 139 kfree(info); 140 + INIT_LIST_HEAD(&mem_device->res_list); 141 return -EINVAL; 142 } 143