Revisión | cdc39c6aaea33a9a47657f7798090ca973053a2f (tree) |
---|---|
Tiempo | 2022-07-25 23:12:00 |
Autor | Francesco Dolcini <francesco.dolcini@tora...> |
Commiter | Stefano Babic |
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>
@@ -381,8 +381,7 @@ int read_tdx_cfg_block(void) | ||
381 | 381 | } |
382 | 382 | |
383 | 383 | /* Cap product id to avoid issues with a yet unknown one */ |
384 | - if (tdx_hw_tag.prodid >= (sizeof(toradex_modules) / | |
385 | - sizeof(toradex_modules[0]))) | |
384 | + if (tdx_hw_tag.prodid >= ARRAY_SIZE(toradex_modules)) | |
386 | 385 | tdx_hw_tag.prodid = 0; |
387 | 386 | |
388 | 387 | out: |
@@ -822,8 +821,7 @@ static int get_cfgblock_carrier_interactive(void) | ||
822 | 821 | |
823 | 822 | printf("Supported carrier boards:\n"); |
824 | 823 | printf("CARRIER BOARD NAME\t\t [ID]\n"); |
825 | - for (int i = 0; i < sizeof(toradex_carrier_boards) / | |
826 | - sizeof(toradex_carrier_boards[0]); i++) | |
824 | + for (int i = 0; i < ARRAY_SIZE(toradex_carrier_boards); i++) | |
827 | 825 | if (toradex_carrier_boards[i]) |
828 | 826 | printf("%s \t\t [%d]\n", toradex_carrier_boards[i], i); |
829 | 827 |