Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S941225AbcJXP3s (ORCPT ); Mon, 24 Oct 2016 11:29:48 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:53488 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935002AbcJXP3p (ORCPT ); Mon, 24 Oct 2016 11:29:45 -0400 From: Arnd Bergmann To: David Woodhouse , Brian Norris Cc: Arnd Bergmann , Julia Lawall , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] mtd: ichxrom: maybe-uninitialized with gcc-4.9 Date: Mon, 24 Oct 2016 17:28:35 +0200 Message-Id: <20161024152853.2673518-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:YXQH9OtcP/E9yZaEEsIbHrsYAHWnM4ZhfVWNWFjJZv/KFPpXh4B Njr91BvdnwH4THFXelaGtvcIyAQx1efB1MxkHX7jY3XXx+4a1Q5PuIV5VCjKHcXKjO7ZfzK Eb4RE7z+JbYWvKKk2tGh3CznnBfUpwlmPrNYHabUrcfdS6Jz93dueaPmCjyVHRg7kwigi/6 a97acblpteaL2Ol+idZyA== X-UI-Out-Filterresults: notjunk:1;V01:K0:R/fJRiuzYhc=:2U7xIAUWoZg9aZtBqXqy0i NbPy9DQbemOLis5dV5pzWq6GTZk0dSR5VOyIMbZGgxc5B7MRfT28n8rjY6JO5Zo4eeJRbHG6y AmX5I7D9epIN23Ni6IY3g1m7iLjbwbobrauCesNSlAL3lGhImT6MqAjeCpPfIrNF7nSD0Nm4Y yIsNnq/ekNfBWET2kLWAwJMRCFfye6NY0PmEOpvznj85kgGi+yRpaYVCIkrr9UnY2D9XSPrPf PREENnX9ycSv5R6wnk5JWzDfAydinN4W2yx7hVm0c8fehVHvultKEDCGVB7KlILMBMzgCZ+Ps wydgNhgVNT/u8Hhi8F8xG60e0T/ICYJy0KQnIPVtMnWM+7eg8cR4d1ErWTRhkY8/ef17W3bVI j0rkTWhqH/XTed424dcXK5tYSbUqRiLdcX6uFVJGVBMRes6USOZYSWM76C+ApGu/vT9QWSz6z DGV1vJ+aXOiwLayTUGlwOM7pU7sab9eeSUl+1Oc1g6PO7+BqRbhMjQUwwxtHtP3l7TYXotza4 VcyjIpmuw8YM5+obuX5TWroogjCYQlctc9U4rBm4ffqrQ+Be0rEh9q7OXuOl2Fm1PIfaINIBz HdG0zVIvHRj9OnvATD+s/oqtEZsbk8YQYvMmDlmdS1psBoOlXIpRNKLuO3BkYG2CFIwZbrvw6 NloWhZrz0IwzSBjneXNlbSEI0Y/HrE/UwUwMpA1A/FlgHokQqDF7ZHbtTgObGZ143NrQWZpdO doxNmM2UZPSAVk62 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1397 Lines: 38 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 --- drivers/mtd/maps/ichxrom.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/maps/ichxrom.c b/drivers/mtd/maps/ichxrom.c index e17d02ae03f0..976d42f63aef 100644 --- a/drivers/mtd/maps/ichxrom.c +++ b/drivers/mtd/maps/ichxrom.c @@ -57,10 +57,12 @@ 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); - pci_write_config_word(window->pdev, BIOS_CNTL, word & ~1); + 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); /* Free all of the mtd devices */ -- 2.9.0