Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: tg3: avoid uninitialized variable warning

The tg3_set_eeprom() function correctly initializes the 'start' variable,
but gcc generates a false warning:

drivers/net/ethernet/broadcom/tg3.c: In function 'tg3_set_eeprom':
drivers/net/ethernet/broadcom/tg3.c:12057:4: warning: 'start' may be used uninitialized in this function [-Wmaybe-uninitialized]

I have not come up with a way to restructure the code in a way that
avoids the warning without making it less readable, so this adds an
initialization for the declaration to shut up that warning.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Arnd Bergmann and committed by
David S. Miller
e434e041 8bdb2908

+1 -1
+1 -1
drivers/net/ethernet/broadcom/tg3.c
··· 12016 12016 int ret; 12017 12017 u32 offset, len, b_offset, odd_len; 12018 12018 u8 *buf; 12019 - __be32 start, end; 12019 + __be32 start = 0, end; 12020 12020 12021 12021 if (tg3_flag(tp, NO_NVRAM) || 12022 12022 eeprom->magic != TG3_EEPROM_MAGIC)