From patchwork Mon Oct 24 15:28:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101627 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp2639451qge; Mon, 24 Oct 2016 08:29:42 -0700 (PDT) X-Received: by 10.98.102.84 with SMTP id a81mr29451105pfc.176.1477322982251; Mon, 24 Oct 2016 08:29:42 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id p69si15872254pfi.270.2016.10.24.08.29.42 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Oct 2016 08:29:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-mtd-bounces+patch=linaro.org@lists.infradead.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1byhBk-0001uP-Px; Mon, 24 Oct 2016 15:29:24 +0000 Received: from mout.kundenserver.de ([212.227.17.13]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1byhBe-0001qV-VB for linux-mtd@lists.infradead.org; Mon, 24 Oct 2016 15:29:21 +0000 Received: from wuerfel.lan. ([78.43.20.153]) by mrelayeu.kundenserver.de (mreue103) with ESMTPA (Nemesis) id 0MGoe9-1cC9Z93l2H-00DViE; Mon, 24 Oct 2016 17:28:55 +0200 From: Arnd Bergmann To: David Woodhouse , Brian Norris 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161024_082919_380357_CF8365E0 X-CRM114-Status: GOOD ( 13.23 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [212.227.17.13 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [212.227.17.13 listed in wl.mailspike.net] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Julia Lawall , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Arnd Bergmann Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org 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 */