Skip to contentSkip to conversation

EDAC, pnd2_edac: Fix Apollo Lake DIMM detection

PATCH Luck, Tony 1 participant 1 message Jun 28, 2017

Subsystems (2)
lore
Share & tools
lore

Luck, Tony

author maintainer
#0 lore raw

From: Tony Luck <[email protected]>

Non-existent or empty DIMM slots result in error return from RD_REGP(). But we shouldn't give up on failure.

So long as we find at least one DIMM we can continue.

Cc Qiuxu Zhuo <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]> (supporter:EDAC-CORE)
Cc [email protected] (open list:EDAC-PND2)
---
 drivers/edac/pnd2_edac.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/edac/pnd2_edac.c +8 -3
index 1cad5a9af8d0..8b287bf3e2ec 100644
@@ -423,16 +423,21 @@ static void dnv_mk_region(char *name, struct region *rp, void *asym)
 
 static int apl_get_registers(void)
 {
+	int ret = -ENODEV;
 	int i;
 
 	if (RD_REG(&asym_2way, b_cr_asym_2way_mem_region_mchbar))
 		return -ENODEV;
 
+	/*
+	 * RD_REGP() will fail for unpopulated or non-existent
+	 * DIMM slots. Return success if we find at least one DIMM.
+	 */
 	for (i = 0; i < APL_NUM_CHANNELS; i++)
-		if (RD_REGP(&drp0[i], d_cr_drp0, apl_dports[i]))
-			return -ENODEV;
+		if (!RD_REGP(&drp0[i], d_cr_drp0, apl_dports[i]))
+			ret = 0;
 
-	return 0;
+	return ret;
 }
 
 static int dnv_get_registers(void)