OSDN Git Service

mtd: ichxrom: maybe-uninitialized with gcc-4.9
authorArnd Bergmann <arnd@arndb.de>
Mon, 24 Oct 2016 15:28:35 +0000 (17:28 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 25 Feb 2018 10:03:44 +0000 (11:03 +0100)
commit9bb2a284c238c163e496163096b7187bbd6918fd
tree59bc8048f10ddc9f18a0dad61d1f9cf8d6562bef
parent78c5a07a72070fffca89b94647e17e13c918e71e
mtd: ichxrom: maybe-uninitialized with gcc-4.9

commit e70dda0868fad0f74c46df21f7f45fec24f29879 upstream.

pci_read_config_word() might fail and not initialize its output,
as pointed out by older versions of gcc when using the -Wmaybe-unintialized
flag:

drivers/mtd/maps/ichxrom.c: In function ‘ichxrom_cleanup’:
drivers/mtd/maps/ichxrom.c:63:2: error: ‘word’ is used uninitialized in this function [-Werror=uninitialized]

This is apparently a correct warning, though it does not show up
with newer compilers. Changing the code to not attempt to write
back uninitialized data into PCI config space is a correct
fix for the problem and avoids the warning.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mtd/maps/ichxrom.c