toradex: common: Use ARRAY_SIZE macro

Use generally available ARRAY_SIZE macro, instead of hand-coding it
every time is needed.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
This commit is contained in:
Francesco Dolcini 2022-07-21 15:17:33 +02:00 committed by Stefano Babic
parent ea1dc32f31
commit cdc39c6aae

View File

@ -381,8 +381,7 @@ int read_tdx_cfg_block(void)
} }
/* Cap product id to avoid issues with a yet unknown one */ /* Cap product id to avoid issues with a yet unknown one */
if (tdx_hw_tag.prodid >= (sizeof(toradex_modules) / if (tdx_hw_tag.prodid >= ARRAY_SIZE(toradex_modules))
sizeof(toradex_modules[0])))
tdx_hw_tag.prodid = 0; tdx_hw_tag.prodid = 0;
out: out:
@ -822,8 +821,7 @@ static int get_cfgblock_carrier_interactive(void)
printf("Supported carrier boards:\n"); printf("Supported carrier boards:\n");
printf("CARRIER BOARD NAME\t\t [ID]\n"); printf("CARRIER BOARD NAME\t\t [ID]\n");
for (int i = 0; i < sizeof(toradex_carrier_boards) / for (int i = 0; i < ARRAY_SIZE(toradex_carrier_boards); i++)
sizeof(toradex_carrier_boards[0]); i++)
if (toradex_carrier_boards[i]) if (toradex_carrier_boards[i])
printf("%s \t\t [%d]\n", toradex_carrier_boards[i], i); printf("%s \t\t [%d]\n", toradex_carrier_boards[i], i);