Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp5434242imb; Thu, 7 Mar 2019 15:58:44 -0800 (PST) X-Google-Smtp-Source: APXvYqzCTYwe+LLxbo45C0ViUJ38beve5zQomE+Htgn0Ev+gZcAxn/z6e0Hi4LVvfi1pbFm6ShT5 X-Received: by 2002:a65:6148:: with SMTP id o8mr13939941pgv.442.1552003124376; Thu, 07 Mar 2019 15:58:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1552003124; cv=none; d=google.com; s=arc-20160816; b=UthUF9+dxuLzyMOTYGFc0VsdSI23FFRXz7D9rw2Wr8pBwm/HtSU/nei17IhRayKa1O JNzCMKH3gt0FV+qp7yitEAh/SF2lbIpaLOQjX/cjeAFJx3mDrjF6jYPZ8eS+ppUEDe61 NiservzK2aS3BSIJ70DoklC3V7LP+lC8zb3TqfHeBJuKhX3PNALXhFcOCxboaiEjOZFo mRfv9tH+ouhbZfySiqmNVV1SLWJfqsvJnsQQFWu79dt0zYBDOLjA6dDozfTT5oocl34z nFSDgVl/5zFqAOIk518BiGFvdR0iRZ5HDIN5veJkpqHqHINXjtkDd+a3/97HwAJ8QIUn 5e3Q== 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:dkim-signature; bh=N0ITOVoBW8yrlydVGEyQDwAmxvx+WvHkFp1+HzwOxiE=; b=LfPE9WqiRa3LyfBtxl58QoSJD+iKgdPgy2x3v0axM4RFiAnN6uB+x+4qBVQnSh52fx aPKRQPacbjkIVdwrhpJMpF4WEpNwe+3O+xcHZ4ENzuU0vfpkaG2LsdvjRPSwanVVxuyZ d45rVHIB44iT1P4EJgvsjRKinuepzdaLfDbxv9/6CB2drflXWiAGEHkm5DeJOVGYqTQs LKPLNldwmeTo4UYZj/fvjvk7nnhjIt+ujUpIgB4ACNc3ElWgVCktE7GR1ImrfPrKITjM QGcykq8vMadK7keeT0CTMbLGAsd2nAbTDoeOZywPKVKIxTA3rpxYWntgZbeN0zoHTChV +xkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VFq06R3P; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 136si5627440pfw.73.2019.03.07.15.58.28; Thu, 07 Mar 2019 15:58:44 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VFq06R3P; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726342AbfCGX5t (ORCPT + 99 others); Thu, 7 Mar 2019 18:57:49 -0500 Received: from mail-ed1-f67.google.com ([209.85.208.67]:41181 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726227AbfCGX5t (ORCPT ); Thu, 7 Mar 2019 18:57:49 -0500 Received: by mail-ed1-f67.google.com with SMTP id x7so14973248eds.8; Thu, 07 Mar 2019 15:57:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=N0ITOVoBW8yrlydVGEyQDwAmxvx+WvHkFp1+HzwOxiE=; b=VFq06R3P2KP4io+KrC42ZTXtQzjfR4l8EcikCu4fUVhl8bExVT5Fq7KvDjG1h62mGX CFcWeKa0JM/KfwW6HEXuVYZd22D+on3JlfM2eh5xc/dRLul3pxOdAwEhhWOPJWfhkSMm Zb0/EArjeoV3hdGGouQf7XoAmrEFfF7B+lAIfxzMFcCBsI1ZgJfV6b9xNCQfaltJfazc cCM5hiYAnJ9HjWW37Kffq71luaIaBynxStrQVe6ySND1UVCk//XmwkqmijzI9QgaBMGm /llJPNSgB0aMVeJJAkjyxey79mU6GAHzZnkrJ+JezdCwYmsLYzWF0+96RXVZ0SCXC6h4 Dg4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=N0ITOVoBW8yrlydVGEyQDwAmxvx+WvHkFp1+HzwOxiE=; b=CxrdfvWBpjR7yfzk10b8zRGnYZpIlifnpbcU3MhBvqQcAegeN0JZFQ1eqE4Ofs6WqW XKdgqX037iDYGyeWWQlgjPRAJ908MSjVV7SXjHEtFmAkDHdbYUnmLwQ13uaGAFPhDAuH ZOGUo2xhlniMI47o8DfWzg4XooPfYcIZfjaGfylYr0hZzCl/WY38wo3pzuoOFUP3gM5B TvlnWRPG6TBuESPR3kMSBDDmA44RB/R9emj5tnZe3j9wrxiTDejket8I5BxqP2IbivqF Rvq6HSbMJiRGsTXanMHeEGp1JgoDe+tlBPDAxrkdXFlpSkC/c9fBwPuaO8//qzObDYUq 96Kg== X-Gm-Message-State: APjAAAXk3bdSAPcrMvhYoNkTiMYq7PZ7ArrWfTSCga+YK7irtEJrbdzZ lJiLWMfnr1n3C1eU0GIoHodoTZZRApvOgw== X-Received: by 2002:a17:906:561a:: with SMTP id f26mr9700580ejq.167.1552003067276; Thu, 07 Mar 2019 15:57:47 -0800 (PST) Received: from localhost.localdomain ([2a01:4f9:2a:1fae::2]) by smtp.gmail.com with ESMTPSA id x34sm1749692edm.70.2019.03.07.15.57.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Mar 2019 15:57:46 -0800 (PST) From: Nathan Chancellor To: Johannes Berg Cc: linux-wireless@vger.kernel.org, "David S. Miller" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Nick Desaulniers , Nathan Chancellor Subject: [PATCH] cfg80211: Change an 'else if' into an 'else' in cfg80211_calculate_bitrate_he Date: Thu, 7 Mar 2019 16:57:35 -0700 Message-Id: <20190307235735.31487-1-natechancellor@gmail.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-Patchwork-Bot: notify Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When building with -Wsometimes-uninitialized, Clang warns: net/wireless/util.c:1223:11: warning: variable 'result' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] Clang can't evaluate at this point that WARN(1, ...) always returns true because __ret_warn_on is defined as !!(condition), which isn't immediately evaluated as 1. Change this branch to else so that it's clear to Clang that we intend to bail out here. Link: https://github.com/ClangBuiltLinux/linux/issues/382 Suggested-by: Nick Desaulniers Signed-off-by: Nathan Chancellor --- net/wireless/util.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/wireless/util.c b/net/wireless/util.c index e4b8db5e81ec..75899b62bdc9 100644 --- a/net/wireless/util.c +++ b/net/wireless/util.c @@ -1220,9 +1220,11 @@ static u32 cfg80211_calculate_bitrate_he(struct rate_info *rate) else if (rate->bw == RATE_INFO_BW_HE_RU && rate->he_ru_alloc == NL80211_RATE_INFO_HE_RU_ALLOC_26) result = rates_26[rate->he_gi]; - else if (WARN(1, "invalid HE MCS: bw:%d, ru:%d\n", - rate->bw, rate->he_ru_alloc)) + else { + WARN(1, "invalid HE MCS: bw:%d, ru:%d\n", + rate->bw, rate->he_ru_alloc); return 0; + } /* now scale to the appropriate MCS */ tmp = result; -- 2.21.0