Merge branch 'next-tpm' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris...
[sfrench/cifs-2.6.git] / arch / arm64 / mm / numa.c
index 146c04ceaa514bace2f7aaa49936ca5ca8865741..d7b66fc5e1c579d047ba262a2607a642e6c2e9e6 100644 (file)
@@ -391,7 +391,6 @@ static int __init numa_init(int (*init_func)(void))
        nodes_clear(numa_nodes_parsed);
        nodes_clear(node_possible_map);
        nodes_clear(node_online_map);
-       numa_free_distance();
 
        ret = numa_alloc_distance();
        if (ret < 0)
@@ -399,20 +398,24 @@ static int __init numa_init(int (*init_func)(void))
 
        ret = init_func();
        if (ret < 0)
-               return ret;
+               goto out_free_distance;
 
        if (nodes_empty(numa_nodes_parsed)) {
                pr_info("No NUMA configuration found\n");
-               return -EINVAL;
+               ret = -EINVAL;
+               goto out_free_distance;
        }
 
        ret = numa_register_nodes();
        if (ret < 0)
-               return ret;
+               goto out_free_distance;
 
        setup_node_to_cpumask_map();
 
        return 0;
+out_free_distance:
+       numa_free_distance();
+       return ret;
 }
 
 /**
@@ -432,7 +435,7 @@ static int __init dummy_numa_init(void)
        if (numa_off)
                pr_info("NUMA disabled\n"); /* Forced off on command line. */
        pr_info("Faking a node at [mem %#018Lx-%#018Lx]\n",
-               0LLU, PFN_PHYS(max_pfn) - 1);
+               memblock_start_of_DRAM(), memblock_end_of_DRAM() - 1);
 
        for_each_memblock(memory, mblk) {
                ret = numa_add_memblk(0, mblk->base, mblk->base + mblk->size);