Skip to contentSkip to conversation

ddr: altera: n5x: Return error if invalid DDR type is detected in argument

PATCH New Jit Loon Lim 1 participant 1 message Nov 23, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ddr: altera: n5x: Return error if invalid DDR type is detected in argument

From: Tien Fong Chee <[email protected]>

Return error immediately if invalid DDR type is detected in argument so that uninitialized local variables such val and upd_val would not be used.

---
 drivers/ddr/altera/sdram_n5x.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/ddr/altera/sdram_n5x.c +3 -0
index 5117a5c4cf..8d28cdbc03 100644
@@ -2430,6 +2430,9 @@ static int set_cal_res_to_umctl2(struct ddr_handoff *handoff,
 
 		upd_val = GET_LOWB_DATA(readw((uintptr_t)(handoff->phy_base +
 					DMEM_MB_CDD_CHB_WW_0_1_OFFSET)));
+	} else {
+		debug("%s: Invalid DDR controller type\n", __func__);
+		return -ENXIO;
 	}
 
 	upd_val = max(val, upd_val);
Signature · 1 line
2.26.2