Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp5443429imb; Thu, 7 Mar 2019 16:11:49 -0800 (PST) X-Google-Smtp-Source: APXvYqyQ0VXabVnHiNUCXJoE9kHKmo7izo0lwUME+fFOyEj/SXvpLcfJLYWpwBv0RxgHuCYnJT6a X-Received: by 2002:a63:5318:: with SMTP id h24mr13934809pgb.76.1552003909760; Thu, 07 Mar 2019 16:11:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1552003909; cv=none; d=google.com; s=arc-20160816; b=EteG6UjGpwl100LOXFLKFRaFdD+ooMqQA9gu/V3/QZuq+aR/ccE4mnW1ieUQ+en5tv Hd7MnT5i9b/437qTRt3d37xr8HrcZW2hVxuwjZcTmg79KG80JU8cdMV8F7oWxlUZlHz1 0qQT3pPVQbuo7ls2upphvGPVK9w6sJrvpUlSm9S5nUIplc3iwa26GZwOV5G0z41suOK5 5+8y60LtOHjkX9x8gO4OVN0SfNHEJia0Ya3YuSE8PA5CzlRdUKJL9/ceA2iU7h8grHeN +em43hwApjRrbhx1SXK0txj4Io5ASw8tknfQC8Nsjzen2SqjiQMsB8AwEydex3dmCs8H SyYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=FPWrQ1cSPMenIAj108hM5wihwBVvhY7nmepw5K/L790=; b=rFgzySpN0oj+w2hmDglrQCoX8DU3u1Slk4k/qBjLKECF5/Ce/ugWBSd4i3dqY6KtzF CeihVOV/0OhlvJ5t7s1OwhEJGjlaAHLC+jgZ95QJGeZcILMnPXDapVs6uOb9aznayYP0 qfi9yaisQx7z9Hq7SnQoPXVpNxCZumgJGgigomT4QhDoRzO3X/04G3zat2de107yepP+ 8EmGJEum6mjaiKauSzuK4hOfN4zWFfggjK9b5bdK0AI0M7/WC2eO1tEMZMQ8N9Wo7IIR 0tLz9gJ1Vu3s4Eaf2HLhsfNveCNaHcXgf0PMv7/lEvwN8SPpMkCKp/H8PJigRQZuCY7N ShNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="rrEh/Kz/"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d12si5244878plo.143.2019.03.07.16.11.34; Thu, 07 Mar 2019 16:11:49 -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=@google.com header.s=20161025 header.b="rrEh/Kz/"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726407AbfCHAKy (ORCPT + 99 others); Thu, 7 Mar 2019 19:10:54 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:36864 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726227AbfCHAKx (ORCPT ); Thu, 7 Mar 2019 19:10:53 -0500 Received: by mail-pf1-f194.google.com with SMTP id s22so12722508pfh.4 for ; Thu, 07 Mar 2019 16:10:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=FPWrQ1cSPMenIAj108hM5wihwBVvhY7nmepw5K/L790=; b=rrEh/Kz/UkCKlwKoFikz58ADbzrpl6uII1IkLRBtSgs+fMTCX19lkMhDpRdwisIdcT 2hyzfRVN1ndSN+K+kVjWsYMXNeeE3n3XoXrMJMEHlYw/aVi5/4cyzrKBUE1H89icFAb7 cyRkqn+/jGJk0YS/ff94hjMCXRmmmHh5PqOjjfihTYHcllBshYeOkqq5KwMZS9gmO/46 CCgSLy/pkXULfqAOcF9xaCY3I0n1epfxQg0qvSj5k9EHOz3tNroBFZrzRYyUsq8oH6fH O70/8IEJNH5oLtZgKykqj9fdPAhisEI9XFftFE9ejNuehLigIKzO+IEi5sL+9TVIEua+ Y5tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FPWrQ1cSPMenIAj108hM5wihwBVvhY7nmepw5K/L790=; b=lfQBHzeYmppQ1CxtWrsEmRABX5Ev13qSkF9wp9xZTUZjmV/fui7t2VwIAdvtGng+Wx 8LmBmc/6Xt792AzECdXyIsD72jHgM2u3KVDilH5xVIfLbLQVSEJlu3TKS2h6PDpW0L+p 7DK+ONl20EBr8A/NbMpQJ6hvNqxbjKp27VMg13ONMnAcHiP9vTnDDpgaOjq3rG+8//ko LDOeLJBVBZJJMueiT2Or1ETQ4L1tYfFfU3eHkgc5oh6hbSc4oqlgfhy3W0iB4MHA6VuU P+104AVWDWr2Dshg8rLoALd3YnaW1KL6mvOK/CLafIbZ99hDy/bTJDy30+IdHw2+Fb4i KnZA== X-Gm-Message-State: APjAAAXcVGnTsKfBEybFmfupulSAzEQLKGFw+9DqW1z1AI5f2nyOUbV2 yToUeRKsK94SSJCWAsAv4DeUTZqfN+2Xfhmg7A2iww== X-Received: by 2002:a17:902:380c:: with SMTP id l12mr4033884plc.238.1552003852417; Thu, 07 Mar 2019 16:10:52 -0800 (PST) MIME-Version: 1.0 References: <20190307235735.31487-1-natechancellor@gmail.com> In-Reply-To: <20190307235735.31487-1-natechancellor@gmail.com> From: Nick Desaulniers Date: Thu, 7 Mar 2019 16:10:41 -0800 Message-ID: Subject: Re: [PATCH] cfg80211: Change an 'else if' into an 'else' in cfg80211_calculate_bitrate_he To: Nathan Chancellor Cc: Johannes Berg , linux-wireless@vger.kernel.org, "David S. Miller" , netdev@vger.kernel.org, LKML , clang-built-linux@googlegroups.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 7, 2019 at 3:57 PM Nathan Chancellor wrote: > > 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 Thanks for the quick fix! Reviewed-by: Nick Desaulniers > --- > 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 > -- Thanks, ~Nick Desaulniers