Commit 495885bc authored by Lionel Debieve's avatar Lionel Debieve
Browse files

drivers: stm32_fmc2_nand: fix boundary check for chip select



Chip select is retrieved from device tree and check
must be done regarding the MAX_CS defined.
Signed-off-by: default avatarLionel Debieve <lionel.debieve@st.com>
Reviewed-by: default avatarChristophe KERELLO <christophe.kerello@st.com>
Change-Id: I03144b133bd51a845a4794f0f6bbd9402fc04936
parent 0c3e8acb
...@@ -908,7 +908,12 @@ int stm32_fmc2_init(void) ...@@ -908,7 +908,12 @@ int stm32_fmc2_init(void)
WARN("Chip select not well defined\n"); WARN("Chip select not well defined\n");
return -FDT_ERR_BADVALUE; return -FDT_ERR_BADVALUE;
} }
stm32_fmc2.cs_sel = fdt32_to_cpu(*cuint); stm32_fmc2.cs_sel = fdt32_to_cpu(*cuint);
if (stm32_fmc2.cs_sel >= MAX_CS) {
return -FDT_ERR_BADVALUE;
}
VERBOSE("NAND CS %i\n", stm32_fmc2.cs_sel); VERBOSE("NAND CS %i\n", stm32_fmc2.cs_sel);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment