[PATCH master 3/5] imx-bbu-nand-fcb: suppress compiler warning about uninitialized use

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Jan 3 03:57:16 PST 2022


fw_orig_len is selectively initialized in read_firmware_all. In case
it's left uninitialized, fw_orig will keep it's initial value of NULL.
fw_orig is checked before fw_orig_len use, so there is no use of an
uninitialized variable in practice, but GCC 11.1.1 warns about it
anyway. Give it an initial value of 0 to silence the warning.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 common/imx-bbu-nand-fcb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/imx-bbu-nand-fcb.c b/common/imx-bbu-nand-fcb.c
index 3b07d539ee6e..bde0b227f81c 100644
--- a/common/imx-bbu-nand-fcb.c
+++ b/common/imx-bbu-nand-fcb.c
@@ -1155,7 +1155,7 @@ static int imx_bbu_nand_update(struct bbu_handler *handler, struct bbu_data *dat
 	enum filetype filetype;
 	unsigned num_blocks_fw, fw_size;
 	int used = 0;
-	int fw_orig_len;
+	int fw_orig_len = 0;
 	int used_refresh = 0, unused_refresh = 0;
 
 	if (data->image) {
-- 
2.30.2




More information about the barebox mailing list