Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4083039img; Tue, 26 Mar 2019 02:38:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqx7dbRkrPjwzVjgybSJ0+mXP/bzMEAYCSC59F/fQ7yFD+xT6tg3WKAhOZ6VZdZrIud+LPls X-Received: by 2002:a17:902:1:: with SMTP id 1mr29469641pla.226.1553593106277; Tue, 26 Mar 2019 02:38:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553593106; cv=none; d=google.com; s=arc-20160816; b=wQgTQ7hnhtc7aCznZasY2HRaYchjzz3b+M0kkEH7y9rKDRtvKo9+I1iyH0REiNGN67 dATfViIiqFBkwySbj+1GTmWrPv3rBIbGBHiu0h6kvHv35sp7q9b1JgStt9dorna9cDoz Xmrti6CDeDCaOm2EW813z8PSvna+pnrDeBL+khLNoGUKXHwMC1Os/QtuxdHRERbElqok HIwrcGag4yujeQNZJd9l0awcfipT2tLe0HTRzPIDop9ek8P1uDeli1mptUf8gfz7rgPk sDg6AJ6rxD0p2CqxSrf8IdsBKSRMXggJI3qAiBnnH9n4ZQj61AB1zBOK0+sG/tjI1mEm IRcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=PSFfo1XYuTsNI5Q++mpIqLdCe2wZvdxW6Z15feDbVU8=; b=w1mijXS4FyBiAC0HNhb4qCz3sCgmJ4LMjbdidnmF3d2HoS2vimfhJ1Dmhvgw+iCdSj HD/zzghaWTEQ15cJD1HzUjontKc0G/7ydcG0qn5dh9V38hQ9tlzyPwYSuI+QxjgnpADj SUkL45tOmCtTNuSbIGld0JxEC4vxwIA8h33TEfs6c7wXj4F16C+WTIoPCGj17gxmyL0F CSgwtcgmhmi/HrJW6ZuL7afXka4WlPR7dROyfY/SwyVtbTFKu0i2dfh+DILIj3LeQzGe 5f89Gmhj+2ZP2E3b+Kz7mkMf4Wu9ujxdh6u18pduLVzLXK+z3jqxJ/nRN56C2Eb759Bl vD/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=BHpocQOL; 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 cc9si17277498plb.59.2019.03.26.02.38.10; Tue, 26 Mar 2019 02:38:26 -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; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=BHpocQOL; 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 S1731233AbfCZJgF (ORCPT + 99 others); Tue, 26 Mar 2019 05:36:05 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:39508 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726266AbfCZJgE (ORCPT ); Tue, 26 Mar 2019 05:36:04 -0400 Received: by mail-ed1-f66.google.com with SMTP id p20so9641034eds.6 for ; Tue, 26 Mar 2019 02:36:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=PSFfo1XYuTsNI5Q++mpIqLdCe2wZvdxW6Z15feDbVU8=; b=BHpocQOLKspioF6M8qgm9e1HETjtxrwoInhXRaWw2KQMUPDmi8+6jZ5+aIerAq9Nc+ KS8uv1pbUyYtWG7tsfG3wEF8UQSLG9VEEkqFRmXFxUCmP0PbRhonrXRd+Nk54z3V5dbp 7ia1xsiWHdzsWZ/8aZ/7UE0TCiBQDfddEtq81VhBA1KGOGdjpSAHJLuM5ijF3I2AUOyX GfyWVsiK8pTKIIjukL6IhdDUNSaYiAJyeG6Gu4gZIlYgAhsPf91+ssqLGQJ+rf0i9crM AXNv6XGaPJFMmWDk1eZhROvhXPm6irjTM+B3xEusO2GS8/9JpU3xf1j/okVvHwl96zjV XXnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=PSFfo1XYuTsNI5Q++mpIqLdCe2wZvdxW6Z15feDbVU8=; b=Uant1Y5Rz9phoqTUkXgEfYYc5sVcC/aOVv/TgVz5drFoaKTyIdzOqWT6i6bFNdTZfi UodSDFhYSW7oKJ1xx0dfUP+fMoCt1JAkmMES38tIzmg+q8u3o8iuOl8CKLqnDvNJF4gy oZgIUzaloPrS20NZwIISZkMkUAzRQBAmuBR6jNehxE0jddgVio6tcrmM656PbqrIxpVZ ErBk0JsduhDjFORmeNK7ukd5aNoDsLZ6V9b+Z+9OYDc/FHJNdcxt4hu/ja/UCzCDaZYW mGSHDh/Tx7yaxLmW4or55Mk9NGsrhK7pyJ23b1mQBAQgpqFr9qx/ZhxjGEqOCrVDRRbh /P+g== X-Gm-Message-State: APjAAAUOmYCtyuMaWs58+Iob04MJFiMnK4WVEttc//Ui5ynb4NFtxSuF iUjq/AdGlxTlS+ymcWVAZPeX7A== X-Received: by 2002:a17:906:c50:: with SMTP id t16mr16268680ejf.97.1553592962876; Tue, 26 Mar 2019 02:36:02 -0700 (PDT) Received: from netronome.com ([2001:982:756:703:d63d:7eff:fe99:ac9d]) by smtp.gmail.com with ESMTPSA id d10sm6577409edk.14.2019.03.26.02.36.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Mar 2019 02:36:02 -0700 (PDT) Date: Tue, 26 Mar 2019 10:36:00 +0100 From: Simon Horman To: Arnd Bergmann Cc: Nathan Chancellor , Johannes Berg , linux-wireless , "David S. Miller" , Networking , Linux Kernel Mailing List , clang-built-linux@googlegroups.com, Nick Desaulniers Subject: Re: [PATCH] cfg80211: Change an 'else if' into an 'else' in cfg80211_calculate_bitrate_he Message-ID: <20190326093558.ymokh5xxyww2dti5@netronome.com> References: <20190307235735.31487-1-natechancellor@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 22, 2019 at 03:16:06PM +0100, Arnd Bergmann wrote: > On Fri, Mar 8, 2019 at 12:57 AM 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 > > --- > > 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; > > + } > > Reviewed-by: Arnd Bergmann > > I independently came up with the same fix before I saw yours, > the only difference was that I avoided the extra curly braces > using > > + else > + return !WARN(1, "invalid HE MCS: bw:%d, ru:%d\n", > + rate->bw, rate->he_ru_alloc); > > to avoid the mix of bare if() and if() {} Right, shouldn't all arms of the if/else if/else conditional have {} if any arm has {}.