Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ea9f5b70 authored by Aneesh Kumar K.V's avatar Aneesh Kumar K.V Committed by Michael Ellerman
Browse files

powerpc/mm/drconf: Use NUMA_NO_NODE on failures instead of node 0



If we fail to parse the associativity array we should default to
NUMA_NO_NODE instead of NODE 0. Rest of the code fallback to the
right default if we find the numa node value NUMA_NO_NODE.

Signed-off-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 89a3496e
Loading
Loading
Loading
Loading
+6 −4
Original line number Original line Diff line number Diff line
@@ -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)
static int of_drconf_to_nid_single(struct drmem_lmb *lmb)
{
{
	struct assoc_arrays aa = { .arrays = NULL };
	struct assoc_arrays aa = { .arrays = NULL };
	int default_nid = 0;
	int default_nid = NUMA_NO_NODE;
	int nid = default_nid;
	int nid = default_nid;
	int rc, index;
	int rc, index;


	if (min_common_depth < 0)
		return default_nid;

	rc = of_get_assoc_arrays(&aa);
	rc = of_get_assoc_arrays(&aa);
	if (rc)
	if (rc)
		return default_nid;
		return default_nid;


	if (min_common_depth > 0 && min_common_depth <= aa.array_sz &&
	if (min_common_depth <= aa.array_sz &&
	    !(lmb->flags & DRCONF_MEM_AI_INVALID) &&
	    !(lmb->flags & DRCONF_MEM_AI_INVALID) && lmb->aa_index < aa.n_arrays) {
	    lmb->aa_index < aa.n_arrays) {
		index = lmb->aa_index * aa.array_sz + min_common_depth - 1;
		index = lmb->aa_index * aa.array_sz + min_common_depth - 1;
		nid = of_read_number(&aa.arrays[index], 1);
		nid = of_read_number(&aa.arrays[index], 1);