From patchwork Fri Mar 22 14:13:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 160902 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp863948jan; Fri, 22 Mar 2019 07:13:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqzjQASp7prqfjxKfzilIe6hNp4j5RniR4Thx2X2cBjTjafE210O1cugVg21/9dk8TU3lPA2 X-Received: by 2002:a62:574d:: with SMTP id l74mr9699645pfb.9.1553264023839; Fri, 22 Mar 2019 07:13:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553264023; cv=none; d=google.com; s=arc-20160816; b=Egsg1mWniA3hmhQopHjKJQTaC4LmrIwAnqu+aaNielDXmM14DPROx0rAg7PyUI82St TjOlcX9eBI9+E0gL/9skFJsbTdHw9uyj4RbILdT3wtxsP271f9aCM+eklarQ6twwcE/Z GAUDP1AVu3h/1VNGqeUYQRogDHOJtiGRuJ1LEoO5fhtCIh/q3jQiFaZ6uTCNfEdnK1F5 SX5hSdSMwmQ4ZEWSMKFJvCyP+at9sxDrSewSn5iidRlxg2mtcdW6wE25YJMxmA65DGKr nCUeN/M6Io/m4kj5p20TuD7UcE6zW0Ym+q2noQfrrHH+h7/HC+iEvo/PFF+9JNzVc0R1 6mNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=VEPEofoQvVhNVtSyFvTSp7FLL7l8RFe/fMyWZyZn0fs=; b=LTGQrtkvVRGGDATnfvfVdwPW7L1J7XX9r9362X0i6K7z2etqMasCWSOg9pvgUlbhf3 Xvoo3QyqJyzad18kBQ1SwOGYGgW1FHvhNjrzTb3rSd28pQ4mWq3pTtWDD2oT93shjv9j Cfv0tL1pmocP0vCO1hV/QdKrmELI+oKhxWseo3rBp8v6k6xBHynqUBHIP72eZZp/4xV9 9i4GlmqB8a9UyDNLTvnsZDniZ4pYQEOPPNuDdIbwxqGsC4too8EetH0cxbfNqQt1RFL7 DmWFqTo0GKHW+K3oqIbEoLN8MGnFGWZXXc8QWcjFdxAYNQMARxj5ATs9EdpMaFqeONwj RLfA== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w10si6502541pgr.469.2019.03.22.07.13.43; Fri, 22 Mar 2019 07:13:43 -0700 (PDT) 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 S1728680AbfCVONl (ORCPT + 31 others); Fri, 22 Mar 2019 10:13:41 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:40703 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727725AbfCVONl (ORCPT ); Fri, 22 Mar 2019 10:13:41 -0400 Received: from wuerfel.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.129]) with ESMTPA (Nemesis) id 1MHGPA-1hBieT1KrI-00DCYI; Fri, 22 Mar 2019 15:13:25 +0100 From: Arnd Bergmann To: Johannes Berg Cc: clang-built-linux@googlegroups.com, Nick Desaulniers , Nathan Chancellor , Arnd Bergmann , Emmanuel Grumbach , Luca Coelho , Intel Linux Wireless , Kalle Valo , "David S. Miller" , Sara Sharon , Avraham Stern , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] iwlwifi: work around clang -Wuninitialized warning Date: Fri, 22 Mar 2019 15:13:08 +0100 Message-Id: <20190322141322.463149-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:8LiqyZKY/9vFF7zcjDNigdSW/6DKivRTQP9iy6iNl7h0N+D52W+ WjHMm4zaTiE1i/Hhs7lC/UTGioE6VlzNpLMhlqy/MQjFaRTUYhlih1WWd9uMGcXbc1LbV9q 0wlcwt/W2jWT94/o41XckfCaMfdNOAv7khoQgihWfyg0mK5E651LokoTA/s6wpulv4as0a9 MpaGM2VhVhbf9+uSoc1Pw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:OqB1nMQOBws=:d3vBzx/V0HessxOj110NiJ gsTseOF2wW+VwFpYB3GPngpbR6OhRrcaNuSmuhGPF6BerpEiq0EGC+pcpFfM5BrhTIf9N1ktn XTn7j9qS1FGM/sDuNPFg9TavkEC05JXveJk/ekvhsKo1IYH6+IS+gE6OCiZ+7mZhIhFKLw0eR 3ry4DaDsTyDhdbV+5Qh6WGtAlj6xPybINn9wTaFzc4BbGqi7Pjn86E0WZDCHE2qJAJ4KqnRny 31czUwJJ4K10OFi0W7Xb07ndDPjAl40PobE+mzUCGlSU60nqqjm0bEqHLWS+0ts0E3vSL7G+B 92rsKrcfGzRy6j2CqN9GMHS/Fd6bjgWAaPvR/U1UzjleC74CScyyf6PzjkKuUmVny/2nMXy+g 9gqNn8MsLUo9dccciwGFMxaAgckOPac84Yt99RZe2b7Bgvx3wHF6OZbP0N/uNAcKkIM6Qi/1K r867fNdg8XuSM/cNwDvsxoi9uHLvtdYhYx8HR21DTzgaOEhR4A7VxlGtoUXC0DBnQ3FZ6D28e NDEavP7mlrvWpAGjqvNWs3H5KgQPYjQ6Gc0rY0YD0FKPTTDFvnDiUGMzL8wzz12nwCcxRsFwg p7SG+u2ambSelrts2pFF5PksAX7CFBxrDRAs7Ffq7iV1h6C2ZPusLQXCZtOvSaabZLKX6Do1V FO0xLZeS0XZ/Ka/SZBBAuXIa6YMhh603fJ84q/FkqsqFH9FnLn3PV13EBrfe/ophuer+QHTx5 ABql4tF9YpEIFH94YRLPnumytCY0I6AEULzgWw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Clang incorrectly warns about an uninitialized variable: drivers/net/wireless/intel/iwlwifi/mvm/sta.c:2114:12: error: variable 'queue' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] else if (WARN(1, "Missing required TXQ for adding bcast STA\n")) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/asm-generic/bug.h:130:36: note: expanded from macro 'WARN' #define WARN(condition, format...) ({ \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/net/wireless/intel/iwlwifi/mvm/sta.c:2119:33: note: uninitialized use occurs here iwl_mvm_enable_txq(mvm, NULL, queue, 0, &cfg, wdg_timeout); ^~~~~ drivers/net/wireless/intel/iwlwifi/mvm/sta.c:2114:8: note: remove the 'if' if its condition is always true else if (WARN(1, "Missing required TXQ for adding bcast STA\n")) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/net/wireless/intel/iwlwifi/mvm/sta.c:2094:11: note: initialize the variable 'queue' to silence this warning int queue; ^ = 0 1 error generated. This cannot happen because the if/else if/else if block always has one code path that is entered. However, we can simply rearrange the code to let clang see this as well. Signed-off-by: Arnd Bergmann --- drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) -- 2.20.0 diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c index 498c315291cf..91ce56d2ebb8 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c @@ -2107,12 +2107,14 @@ int iwl_mvm_send_add_bcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif) if (!iwl_mvm_has_new_tx_api(mvm)) { if (vif->type == NL80211_IFTYPE_AP || - vif->type == NL80211_IFTYPE_ADHOC) + vif->type == NL80211_IFTYPE_ADHOC) { queue = mvm->probe_queue; - else if (vif->type == NL80211_IFTYPE_P2P_DEVICE) + } else if (vif->type == NL80211_IFTYPE_P2P_DEVICE) { queue = mvm->p2p_dev_queue; - else if (WARN(1, "Missing required TXQ for adding bcast STA\n")) + } else { + WARN(1, "Missing required TXQ for adding bcast STA\n"); return -EINVAL; + } bsta->tfd_queue_msk |= BIT(queue);