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: I0bb37c51311d202729b7fb9731d6eec0a28dc040 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/212330 Reviewed-by: Furquan Shaikh <furquan@chromium.org>
This commit is contained in:
parent
c8f09e61e3
commit
4cbe74905b
2 changed files with 2 additions and 1 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue