From patchwork Fri Jan 25 14:14:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 215742 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id AAA282C008C for ; Sat, 26 Jan 2013 01:16:33 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932606Ab3AYOPZ (ORCPT ); Fri, 25 Jan 2013 09:15:25 -0500 Received: from moutng.kundenserver.de ([212.227.17.8]:56757 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932348Ab3AYOPV (ORCPT ); Fri, 25 Jan 2013 09:15:21 -0500 Received: from wuerfel.lan (HSI-KBW-46-223-90-92.hsi.kabel-badenwuerttemberg.de [46.223.90.92]) by mrelayeu.kundenserver.de (node=mreu2) with ESMTP (Nemesis) id 0M6RLT-1UvmbC2QlX-00xxtp; Fri, 25 Jan 2013 15:14:57 +0100 From: Arnd Bergmann To: linux-arm-kernel@list.infradead.org Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , Johannes Berg , "John W. Linville" , "David S. Miller" , linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH 16/19] mac80211: avoid a build warning Date: Fri, 25 Jan 2013 14:14:33 +0000 Message-Id: <1359123276-15833-17-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1359123276-15833-1-git-send-email-arnd@arndb.de> References: <1359123276-15833-1-git-send-email-arnd@arndb.de> X-Provags-ID: V02:K0:efblcJqqJZeEcNfH6HaDuxp/TXlplONnE0GryA4/XoO EeH9C2GAWfIY2Y5kCWq/MjIbor0pDureXLaamYOEH9Io2Z7CPK s8z0mNw+vZSsqUxluqc7+QnskAwkKeX0JMPdFj1OiO0Si2EXCk MThnZxCWEH2gSupqPWGytn1Sk/oiI8weNwjn4R4xooaxFW1lrU xIFi8zg8DltYCKEpESGAM/9sfTTnIMdTnWO/+0X8cP/IDsrUPW zbSj4FmzdiE9YznJ+q+tXObe+gKVSlFGE4rwyBGYkOLIvnYagp io+SSuDvhYkWVsePRz7ZuFOau9hEPkJSRqseCULWEAUVH7PS9Q I1QaJn9zoni9xfQ307dy3LO4yqA1UtS0v4qkXH7n9 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org gcc cannot prove that the value of sdata->vif.type does not change between the switch() statement and the second comparison to NL80211_IFTYPE_AP, causing a harmless warning. Slightly reordering the code makes the warning go away with no functional change. Without this patch, building ARM at91sam9g45_defconfig with gcc-4.6 results in: net/mac80211/tx.c: In function 'ieee80211_subif_start_xmit': net/mac80211/tx.c:1797:22: warning: 'chanctx_conf' may be used uninitialized in this function [-Wuninitialized] Signed-off-by: Arnd Bergmann Cc: Johannes Berg Cc: "John W. Linville" Cc: "David S. Miller" Cc: linux-wireless@vger.kernel.org Cc: netdev@vger.kernel.org --- net/mac80211/tx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index e9eadc4..df589bf 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -1784,16 +1784,16 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, break; /* fall through */ case NL80211_IFTYPE_AP: + if (sdata->vif.type == NL80211_IFTYPE_AP) + chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); + if (!chanctx_conf) + goto fail_rcu; fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS); /* DA BSSID SA */ memcpy(hdr.addr1, skb->data, ETH_ALEN); memcpy(hdr.addr2, sdata->vif.addr, ETH_ALEN); memcpy(hdr.addr3, skb->data + ETH_ALEN, ETH_ALEN); hdrlen = 24; - if (sdata->vif.type == NL80211_IFTYPE_AP) - chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); - if (!chanctx_conf) - goto fail_rcu; band = chanctx_conf->def.chan->band; break; case NL80211_IFTYPE_WDS: