Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3284160img; Mon, 25 Mar 2019 07:21:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqyufo/MLwc+cJ97UA/PPA5n9jiJk2cdqCZkGsYKfX/PK6H26MREDnB2IQn8THWi7H1m+3mc X-Received: by 2002:a62:e910:: with SMTP id j16mr24212450pfh.44.1553523672536; Mon, 25 Mar 2019 07:21:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553523672; cv=none; d=google.com; s=arc-20160816; b=xyXgd6bTw1gKzEoGQnGm2H6hbTToPrvztromjImrckysBSYRkCSSLxr28YwWOotxVD dkpDPcM/qBBqZEFy9VohhWWdtzoSvWGDTLFMTd42veGKvJPerSTNY7/nryy+OeHbZvAz hdFGNDBU2k35py/zmuf8PvnuZfKlBB/IzKIEnGrkFwjkzK3xITN8tVh2sCk0gfa07wtP PHNN75yKVDwNu9aqvQR079VbSX5Zoc+xHWcTO1yB1rmKGj2yURyqWGAOX76YPvJwDJ6y y+CJ54KYLGCvll18jQkbpbnz54BXYw60fZHEUi7Io/2UJS8g5lLLmGx1/VrMgymjDe5b O3PQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7cUqakoGwW9v2V+piiFQS3g8t87PA5xNvW5kZqir9uA=; b=uL9q0OjXvsb9D2fOzpTXCT7PiAc47cBzpbXFcPwsH1sAiFBulZuH4t8J+2ibvI50KW /4FW5MaRaULAdgqq5U1ESGK+qSQ+ed1UXiM/sjuPznCwBNyUAQkgcy6wkbaCHMAHPflk 9s1JmVNEVY6Q/zf9hhKCjZTu1rhDHGRJSLhuNnp+Hpr2/3CEwlf9F9Yyq3bEqEE1rqlD 5b1pn0gCMmpiFE7xrTqyeMLvAiaD17zRQlmPwfqRDb7EYAMFrtCbnB8mbJ0SNC4+8Rw1 FgRwhhDveDwz6eSJZ6hKCIH5pI3r+OsMaXW8Q+dzzUCCvcQxlE2a6O8V/kZ72clSbmml WllQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AgX6rDSr; 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 g12si14633021pla.52.2019.03.25.07.20.57; Mon, 25 Mar 2019 07:21:12 -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=@gmail.com header.s=20161025 header.b=AgX6rDSr; 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 S1729132AbfCYOUW (ORCPT + 99 others); Mon, 25 Mar 2019 10:20:22 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:39291 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725747AbfCYOUW (ORCPT ); Mon, 25 Mar 2019 10:20:22 -0400 Received: by mail-wm1-f68.google.com with SMTP id t124so9263645wma.4; Mon, 25 Mar 2019 07:20:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7cUqakoGwW9v2V+piiFQS3g8t87PA5xNvW5kZqir9uA=; b=AgX6rDSr1NxOEoBGnEuR05Z5RhyEzjC839L5eQxHkHukx2E7cChdNC+d0rybL6E1Dx k1OQGb/Q0qghZHzh2zWaLH9JkEfv0rMcJARK/a7asrAebzQZtVX3gLaPB1EkMg0FDS8K Q/S+qsnCfWof4ME+SUrW8KH2j0p7TYmdzZf3xfaNnCNufcreFQYeSlyuvwaZ5MwBcPjJ byalfieVD+2rjHCCtFxlaCaAwgpu9bAZQCAlMR9h4TVM8nQe6e5C+B6c61C+Tg7uLs1L XXY4fGSZ85gP9TLiFIIz/1Zm76vUTPEv5nsHhJzZjAI9rUlb07pnuot3sCHopf4Zf+pO lbKg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=7cUqakoGwW9v2V+piiFQS3g8t87PA5xNvW5kZqir9uA=; b=h5eWv9SyksRW/mUtw2LVHbtMUkxLj0fD9l7hsAREgmKZvhAmjsbQRNOTewC+ofIWyC 0+hC7rEHFWQDRMMqZEcLRe++p8puwTCb1PLEUWdLxYyG0BrDoa5jMHZST59t6J/u2+6G 6tn5yclKjznj3AftELOQY7B/vpXjvHG0m08i977GYNW9GQ9AxoKyNOIxGTsppHZAEaq5 bblRRxZDX2BqQ6b7a9zeP/JlNzPY56YU4fI7jho5tokQRA4GXSN8hhlXe2OK4DAmsyi/ EBMeeVHHiXSJeNMdkTos0v7p0PzMcGfOn0U7aqM07Smf0rKx8C8sYk+USWmDkEKPnRGT mv2Q== X-Gm-Message-State: APjAAAUCPWGHY6dP3qRAFTXXKlc9L+MFHgizDgkypQFkCIT08eyUOqad ejp8R4JTPjaAaQzcGUmpQno= X-Received: by 2002:a7b:c7d0:: with SMTP id z16mr12222967wmk.136.1553523619602; Mon, 25 Mar 2019 07:20:19 -0700 (PDT) Received: from debian64.daheim (p4FD09746.dip0.t-ipconnect.de. [79.208.151.70]) by smtp.gmail.com with ESMTPSA id 13sm2941499wmf.23.2019.03.25.07.20.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 25 Mar 2019 07:20:18 -0700 (PDT) Received: from localhost.daheim ([127.0.0.1] helo=debian64.localnet) by debian64.daheim with esmtp (Exim 4.92) (envelope-from ) id 1h8QSI-0006ww-Fs; Mon, 25 Mar 2019 15:20:02 +0100 From: Christian Lamparter To: Arnd Bergmann , Kalle Valo Cc: "David S. Miller" , clang-built-linux@googlegroups.com, Nick Desaulniers , Nathan Chancellor , Dan Carpenter , "Gustavo A. R. Silva" , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] wireless: carl9170: fix clang build warning Date: Mon, 25 Mar 2019 15:20:02 +0100 Message-ID: <10158331.jkizvXajyz@debian64> In-Reply-To: <20190325124354.1413529-1-arnd@arndb.de> References: <20190325124354.1413529-1-arnd@arndb.de> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Monday, March 25, 2019 1:43:44 PM CET Arnd Bergmann wrote: > clang fails to eliminate some dead code with always-taken branches > when CONFIG_PROFILE_ANNOTATED_BRANCHES is set, leading to a false-positive > warning: > > drivers/net/wireless/ath/carl9170/mac.c:522:3: error: variable 'power' is used uninitialized whenever 'if' condition is > false [-Werror,-Wsometimes-uninitialized] > BUG_ON(1); > ^~~~~~~~~ > > Change both instances of BUG_ON(1) in carl9170 to the simpler BUG() > to avoid the warning. > > Signed-off-by: Arnd Bergmann Heh, I added these "default:" cases back in the day to make gcc shut-up about "switch is missing cases" warnings. And now I guess it's clangs time to complain. (-; Especially the "default case" in carl9170_rx_untie_data is hilarious. Since all the possible cases (just 4!) have been addressed and the "default" is deadcode. I think gcc did not consider the AR9170_RX_STATUS_MPDU mask in the | switch (mac_status & AR9170_RX_STATUS_MPDU) { statement. However I'll be waiting for the day until the deadcode elimination warnings will show up. Anyway, Acked-by: Christian Lamparter Regards, Christian > --- > drivers/net/wireless/ath/carl9170/mac.c | 2 +- > drivers/net/wireless/ath/carl9170/rx.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/wireless/ath/carl9170/mac.c b/drivers/net/wireless/ath/carl9170/mac.c > index 7d4a72dc98db..b2eeb9fd68d2 100644 > --- a/drivers/net/wireless/ath/carl9170/mac.c > +++ b/drivers/net/wireless/ath/carl9170/mac.c > @@ -519,7 +519,7 @@ int carl9170_set_mac_tpc(struct ar9170 *ar, struct ieee80211_channel *channel) > power = ar->power_5G_leg[0] & 0x3f; > break; > default: > - BUG_ON(1); > + BUG(); > } > > power = min_t(unsigned int, power, ar->hw->conf.power_level * 2); > diff --git a/drivers/net/wireless/ath/carl9170/rx.c b/drivers/net/wireless/ath/carl9170/rx.c > index 8e154f6364a3..23ab8a80c18c 100644 > --- a/drivers/net/wireless/ath/carl9170/rx.c > +++ b/drivers/net/wireless/ath/carl9170/rx.c > @@ -795,7 +795,7 @@ static void carl9170_rx_untie_data(struct ar9170 *ar, u8 *buf, int len) > break; > > default: > - BUG_ON(1); > + BUG(); > break; > } > >