From patchwork Thu Mar 7 23:57:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 10844005 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 07F8D1575 for ; Thu, 7 Mar 2019 23:57:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E78E62F435 for ; Thu, 7 Mar 2019 23:57:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DAE9F2F58D; Thu, 7 Mar 2019 23:57:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 86BE92F435 for ; Thu, 7 Mar 2019 23:57:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726324AbfCGX5t (ORCPT ); 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-Google-Smtp-Source: APXvYqyvS/tp3wg+FrWOdlDw1LimnCqWHzwGaE1VKQbK7KuELBMSlxEikOVm7nQ83hGRzI+GZPOnOw== 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 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Nick Desaulniers Reviewed-by: Arnd Bergmann --- 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;