powerpc/mm/drconf: Use NUMA_NO_NODE on failures instead of node 0
[linux-2.6-block.git] / arch / powerpc / mm / numa.c
index 26f479e6c8ede12283e86b0176d9599d87daa775..b1ecfb850b5a9978a43bb63cb19df99de09a7e75 100644 (file)
@@ -436,17 +436,19 @@ static int of_get_assoc_arrays(struct assoc_arrays *aa)
 static int of_drconf_to_nid_single(struct drmem_lmb *lmb)
 {
        struct assoc_arrays aa = { .arrays = NULL };
-       int default_nid = 0;
+       int default_nid = NUMA_NO_NODE;
        int nid = default_nid;
        int rc, index;
 
+       if (min_common_depth < 0)
+               return default_nid;
+
        rc = of_get_assoc_arrays(&aa);
        if (rc)
                return default_nid;
 
-       if (min_common_depth > 0 && min_common_depth <= aa.array_sz &&
-           !(lmb->flags & DRCONF_MEM_AI_INVALID) &&
-           lmb->aa_index < aa.n_arrays) {
+       if (min_common_depth <= aa.array_sz &&
+           !(lmb->flags & DRCONF_MEM_AI_INVALID) && lmb->aa_index < aa.n_arrays) {
                index = lmb->aa_index * aa.array_sz + min_common_depth - 1;
                nid = of_read_number(&aa.arrays[index], 1);