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>
This commit is contained in:
parent
08e36c94ce
commit
7158f609c9
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#define FUNIT_INDEX(_name) FUNIT_##_name
|
||||
|
||||
enum {
|
||||
FUNIT_NONE = 0,
|
||||
FUNIT_INDEX(SBC1),
|
||||
FUNIT_INDEX(SBC4),
|
||||
FUNIT_INDEX(I2C2),
|
||||
|
|
Loading…
Reference in New Issue