diff options
author | Aaron Durbin <adurbin@chromium.org> | 2014-08-13 15:25:55 -0500 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2015-03-26 00:27:17 +0100 |
commit | 7158f609c94d006cbb2af24558401628cd1baebd (patch) | |
tree | 78bab87a04ff3e78719fefa4b0d56fbe2a7ad7de /src/soc | |
parent | 08e36c94ce42d4beb29f03d09208331d8704bca7 (diff) |
tegra132: provide more robust array bounds checking
Make sure the array size matches the number of supported
FUNITs. Also remove the FUNIT_NONE enumeration so that
there isn't an empty slot in the array at index 0.
BUG=chrome-os-partner:31251
BRANCH=None
TEST=Built when array wasn't large enough. Compiler threw an error.
Change-Id: I1b83ddff799a56ea39efa23a91dca1a9e0f10862
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 4cbe74905bbeb815e9f20bcc0fad3751a3133b04
Original-Change-Id: I0bb37c51311d202729b7fb9731d6eec0a28dc040
Original-Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/212330
Original-Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: http://review.coreboot.org/8935
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/soc')
-rw-r--r-- | src/soc/nvidia/tegra132/funitcfg.c | 2 | ||||
-rw-r--r-- | src/soc/nvidia/tegra132/include/soc/funitcfg.h | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/src/soc/nvidia/tegra132/funitcfg.c b/src/soc/nvidia/tegra132/funitcfg.c index 6d4cd2b6fd..e89670bfdf 100644 --- a/src/soc/nvidia/tegra132/funitcfg.c +++ b/src/soc/nvidia/tegra132/funitcfg.c @@ -82,6 +82,8 @@ static const struct funit_cfg_data funit_data[] = { FUNIT_DATA(SDMMC3, sdmmc3, U), FUNIT_DATA(SDMMC4, sdmmc4, L), }; +_Static_assert(ARRAY_SIZE(funit_data) == FUNIT_INDEX_MAX, + "funit_cfg_data array not filled out!"); static inline uint32_t get_clk_src_freq(uint32_t clk_src) { diff --git a/src/soc/nvidia/tegra132/include/soc/funitcfg.h b/src/soc/nvidia/tegra132/include/soc/funitcfg.h index ac7f7f95d7..0bb20a537d 100644 --- a/src/soc/nvidia/tegra132/include/soc/funitcfg.h +++ b/src/soc/nvidia/tegra132/include/soc/funitcfg.h @@ -28,7 +28,6 @@ #define FUNIT_INDEX(_name) FUNIT_##_name enum { - FUNIT_NONE = 0, FUNIT_INDEX(SBC1), FUNIT_INDEX(SBC4), FUNIT_INDEX(I2C2), |