ddr: altera: n5x: Return error if invalid DDR type is detected in argument
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.
Signed-off-by Tien Fong Chee <[email protected]>
Signed-off-by Jit Loon Lim <[email protected]>
--- drivers/ddr/altera/sdram_n5x.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/ddr/altera/sdram_n5x.c +3 -0
@@ -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