Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e70dda08 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Brian Norris
Browse files

mtd: ichxrom: maybe-uninitialized with gcc-4.9



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: default avatarArnd Bergmann <arnd@arndb.de>
Reviewed-by: default avatarMarek Vasut <marex@denx.de>
Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
parent 6080ef6e
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -57,9 +57,11 @@ static void ichxrom_cleanup(struct ichxrom_window *window)
{
	struct ichxrom_map_info *map, *scratch;
	u16 word;
	int ret;

	/* Disable writes through the rom window */
	pci_read_config_word(window->pdev, BIOS_CNTL, &word);
	ret = pci_read_config_word(window->pdev, BIOS_CNTL, &word);
	if (!ret)
		pci_write_config_word(window->pdev, BIOS_CNTL, word & ~1);
	pci_dev_put(window->pdev);