mmc-utils: mmc_cmds: fix type-punned warning on &ext_csd[] casting

When building with -Werror=strict-aliasing error is thrown:

mmc_cmds.c: In function 'do_ffu':
mmc_cmds.c:2972:2: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
  sect_done = htole32(*((__u32 *)&ext_csd[EXT_CSD_NUM_OF_FW_SEC_PROG_0]));
  ^
cc1: all warnings being treated as errors

Let's fix type-punned breaking strict-aliasing by implementing local
per_byte_htole32(__u8 *) and use it for the 2 present occurences of
htole32(). Let's also change sect_done type to __u32 for consistency.

Suggested-by: Avri Altman <Avri.Altman@wdc.com>
Fixes: a1b594ca735e ("mmc-utils: ffu: Simplify ext_csd bytes parsing")
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Link: https://lore.kernel.org/r/20240305184513.400364-1-giulio.benetti@benettiengineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 file changed