]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
toradex: common: Use ARRAY_SIZE macro
authorFrancesco Dolcini <francesco.dolcini@toradex.com>
Thu, 21 Jul 2022 13:17:33 +0000 (15:17 +0200)
committerStefano Babic <sbabic@denx.de>
Mon, 25 Jul 2022 14:12:00 +0000 (16:12 +0200)
Use generally available ARRAY_SIZE macro, instead of hand-coding it
every time is needed.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
board/toradex/common/tdx-cfg-block.c

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