mm/memory_hotplug: create memory block devices after arch_add_memory()
[linux-2.6-microblaze.git] / mm / memory_hotplug.c
index bc11888..7829152 100644 (file)
@@ -259,13 +259,7 @@ static int __meminit __add_section(int nid, unsigned long phys_start_pfn,
                return -EEXIST;
 
        ret = sparse_add_one_section(nid, phys_start_pfn, altmap);
-       if (ret < 0)
-               return ret;
-
-       if (!want_memblock)
-               return 0;
-
-       return hotplug_memory_register(nid, __pfn_to_section(phys_start_pfn));
+       return ret < 0 ? ret : 0;
 }
 
 /*
@@ -1105,6 +1099,13 @@ int __ref add_memory_resource(int nid, struct resource *res)
        if (ret < 0)
                goto error;
 
+       /* create memory block devices after memory was added */
+       ret = create_memory_block_devices(start, size);
+       if (ret) {
+               arch_remove_memory(nid, start, size, NULL);
+               goto error;
+       }
+
        if (new_node) {
                /* If sysfs file of new node can't be created, cpu on the node
                 * can't be hot-added. There is no rollback way now.