From patchwork Wed Jan 27 14:04:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101069 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp2604035lbb; Wed, 27 Jan 2016 06:09:35 -0800 (PST) X-Received: by 10.98.7.74 with SMTP id b71mr42991037pfd.38.1453903775179; Wed, 27 Jan 2016 06:09:35 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 7si9752310pfk.172.2016.01.27.06.09.34; Wed, 27 Jan 2016 06:09:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933141AbcA0OJd (ORCPT + 30 others); Wed, 27 Jan 2016 09:09:33 -0500 Received: from mout.kundenserver.de ([212.227.126.135]:53211 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932694AbcA0OHm (ORCPT ); Wed, 27 Jan 2016 09:07:42 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue002) with ESMTPA (Nemesis) id 0LvN23-1ZygP20QZ1-010fhg; Wed, 27 Jan 2016 15:07:07 +0100 From: Arnd Bergmann To: "David S. Miller" Cc: linux-arm-kernel@lists.infradead.org, Arnd Bergmann , netdev@vger.kernel.org, "Maciej W. Rozycki" , linux-kernel@vger.kernel.org Subject: [PATCH 5/9] net: fddi/defxx: avoid warning about uninitialized variable use Date: Wed, 27 Jan 2016 15:04:55 +0100 Message-Id: <1453903507-3427225-6-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1453903507-3427225-1-git-send-email-arnd@arndb.de> References: <1453903507-3427225-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:ck224WuWEXiS4C87PPJmnarn1tFkJX3DqXN82A4qbDYj1w161Fw YUjJRiV980K6eZbFUIGXqqcpoA79ThrV/zHSeS6iU+lLdFpxS5gEjfGPlwLS17jkHGugUyF Yd/FdX6pgj3PdJES+5O25fRhiEfG+LHZttw+f+3hmaSCrQZAHF0VrFZV5Y/pDGyAf+sPfSN SdO4cDPq9C93kY4MRuErg== X-UI-Out-Filterresults: notjunk:1; V01:K0:8KnfbbC16+s=:yMYEMXuyshxvghHcYLU0Ax bgHzEGCx1cxysX2AurW2rJLSqd4cH6U44JCkf5TlhzEsBQaa5B/cdiP+9CFw/kCpukLUBrmGR nMVdgiDPSxVll0Ctow8JRTGyaWocQOT24VkUKucGb9RWA6nbIfCVonZm29nsL26fLjaq0+GQK YeO8taZZwag2QmvO4uKBogap6T0F7FgCmPgVa0WTSksBEYcI0jZFthg8IO56LrwwE241EK5El 8i71ZB7RKTMqiIE6+WqCzoQCwO6107MLFoGvyMc2Ia5e4Xn7kdrVuIMBA18T+TweP1NJhtbfb hUNueSp6hofkz0P1ob0vIdOiXBciR0n7gVG83PKWlvIXoVRDS/bkOpcNDoG6uHIVh6jkxNvpJ qDHPYTAIyNerG+M8K2AZSRfppypeJnWGIrA89AVNxboLKYaGCHD2IzEBI+Xhjb3SiliJrNX7u vOk7GRKN464m0nP+CAiu4uSqiTV0XBWOSAfFrpt7t51p8VDsgg3QyR6RfwgM/DBWZtcPl79D7 PVyAL5a2OIjddz9M9b/HON4DA0lr7QtfpiS5MdVF2uyAoDHymWZgsP5v+yuy9etENv1gh6OfQ +uCAVQK1NxvgKbaHH++JnXRlUgTHK4glqq8w9HMRW75qaLV7L3NqxcfVnA6sCi/lNxmz4xt6E TzgpEBIx7kiZ8/MJXouEEEnAxWPtKj9etZuSs4OFVkx7Tjw4mwZ2Mdi3z7gch4VNYbMc= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The defxx driver can be configured for different kinds of buses, and appears to be handling this correctly, but the compiler cannot see how it always initializes the bar_start and bar_length fields it uses depending on the configured bus, so we get a warning with recent gcc versions: fddi/defxx.c: In function 'dfx_pci_unregister': fddi/defxx.c:3726:3: warning: 'bar_len' may be used uninitialized in this function [-Wmaybe-uninitialized] release_mem_region(bar_start[0], bar_len[0]); fddi/defxx.c:3701:18: note: 'bar_len' was declared here resource_size_t bar_len[3]; /* resource lengths */ fddi/defxx.c:3726:3: warning: 'bar_start' may be used uninitialized in this function [-Wmaybe-uninitialized] release_mem_region(bar_start[0], bar_len[0]); fddi/defxx.c:3700:18: note: 'bar_start' was declared here resource_size_t bar_start[3]; /* pointers to ports */ ^ fddi/defxx.c: In function 'dfx_pci_register': fddi/defxx.c:617:18: warning: 'bar_len' may be used uninitialized in this function [-Wmaybe-uninitialized] bp->base.mem = ioremap_nocache(bar_start[0], bar_len[0]); fddi/defxx.c:537:18: note: 'bar_len' was declared here resource_size_t bar_len[3]; /* resource length */ fddi/defxx.c:1125:2: warning: 'bar_start' may be used uninitialized in this function [-Wmaybe-uninitialized] pr_info("%s: %s at %s addr = 0x%llx, IRQ = %d, Hardware addr = %pMF\n", fddi/defxx.c:536:18: note: 'bar_start' was declared here resource_size_t bar_start[3]; /* pointers to ports */ This adds code to ensure that the BAR values are initialized even in the impossible case when a device gets probed that does not belong to any bus. This shuts up the warning. Signed-off-by: Arnd Bergmann --- drivers/net/fddi/defxx.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.7.0 diff --git a/drivers/net/fddi/defxx.c b/drivers/net/fddi/defxx.c index 7f975a2c8990..e7cdd1226d39 100644 --- a/drivers/net/fddi/defxx.c +++ b/drivers/net/fddi/defxx.c @@ -484,6 +484,11 @@ static void dfx_get_bars(struct device *bdev, bar_start[2] = bar_start[1] = 0; bar_len[2] = bar_len[1] = 0; } + if (!(dfx_bus_pci || dfx_bus_eisa || dfx_bus_tc)) { + dev_err(bdev, "invalid bus configuration\n"); + bar_start[2] = bar_start[1] = bar_start[0] = 0; + bar_len[2] = bar_len[1] = bar_len[0] = 0; + } } static const struct net_device_ops dfx_netdev_ops = {