summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Ziswiler <marcel.ziswiler@toradex.com>2016-02-17 11:15:12 +0100
committerMax Krummenacher <max.krummenacher@toradex.com>2016-03-09 15:03:34 +0100
commit9e701886d093838d1a0f6298b9e2bc58b80e0052 (patch)
treeeaef03607888402b5331c539f56668d909ac7ca6
parentbf381b1a3079e88ef3c184214c06048d577ef296 (diff)
toradex: configblock: cap product id
Cap product id to avoid issues with a yet unknown one. Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
-rw-r--r--board/toradex/common/configblock.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/board/toradex/common/configblock.c b/board/toradex/common/configblock.c
index d1f6aa0454d..5b94882d62e 100644
--- a/board/toradex/common/configblock.c
+++ b/board/toradex/common/configblock.c
@@ -45,6 +45,7 @@ struct toradex_eth_addr trdx_eth_addr;
u32 trdx_serial;
const char* const toradex_modules[] = {
+ [0] = "UNKNOWN MODULE",
[1] = "Colibri PXA270 312MHz",
[2] = "Colibri PXA270 520MHz",
[3] = "Colibri PXA320 806MHz",
@@ -62,6 +63,8 @@ const char* const toradex_modules[] = {
[15] = "Colibri iMX6 DualLite 512MB",
[16] = "Colibri iMX6 Solo 256MB IT",
[17] = "Colibri iMX6 DualLite 512MB IT",
+ [18] = "UNKNOWN MODULE",
+ [19] = "UNKNOWN MODULE",
[20] = "Colibri T20 256MB",
[21] = "Colibri T20 512MB",
[22] = "Colibri T20 512MB IT",
@@ -212,6 +215,10 @@ int read_trdx_cfg_block(void)
offset += tag->len * 4;
}
+ /* Cap product id to avoid issues with a yet unknown one */
+ if (trdx_hw_tag.prodid > (sizeof(toradex_modules) / sizeof(toradex_modules[0])))
+ trdx_hw_tag.prodid = 0;
+
out:
free(config_block);
return ret;