From: Tarek BOCHKATI Date: Mon, 11 Jan 2021 18:21:06 +0000 (+0100) Subject: flash/stmqspi: fix build error with -Werror=maybe-uninitialized X-Git-Tag: v0.11.0-rc2~9 X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=commitdiff_plain;h=310c9800c72f37dd50e855513badc908fcfbafcf;hp=aaa6110d9b027acd1d027ef27c723ec9cf2381a0 flash/stmqspi: fix build error with -Werror=maybe-uninitialized using gcc 9.3 on ubuntu focal fossa with -Werror=maybe-uninitialized we get this error: /src/flash/nor/stmqspi.c: In function ‘read_flash_id’: /src/flash/nor/stmqspi.c:1948:6: error: ‘retval’ may be used uninitialized Change-Id: Ifd8ae60df847fc61e22ca100c008e3914c9af79b Signed-off-by: Tarek BOCHKATI Reviewed-on: http://openocd.zylin.com/6012 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI Reviewed-by: Antonio Borneo --- diff --git a/src/flash/nor/stmqspi.c b/src/flash/nor/stmqspi.c index f54e4975dd..a013336a0f 100644 --- a/src/flash/nor/stmqspi.c +++ b/src/flash/nor/stmqspi.c @@ -1945,7 +1945,7 @@ static int read_flash_id(struct flash_bank *bank, uint32_t *id1, uint32_t *id2) uint32_t io_base = stmqspi_info->io_base; uint8_t byte; unsigned int type, count, len1, len2; - int retval; + int retval = ERROR_OK; /* invalidate both ids */ *id1 = 0;