From patchwork Thu Apr 6 18:56:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Kaehlcke X-Patchwork-Id: 9668095 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.web.codeaurora.org (Postfix) with ESMTP id 7C288602B3 for ; Thu, 6 Apr 2017 18:57:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 64872200E7 for ; Thu, 6 Apr 2017 18:57:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 557F726530; Thu, 6 Apr 2017 18:57:03 +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=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 D7525200E7 for ; Thu, 6 Apr 2017 18:57:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932793AbdDFS5B (ORCPT ); Thu, 6 Apr 2017 14:57:01 -0400 Received: from mail-it0-f43.google.com ([209.85.214.43]:35355 "EHLO mail-it0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756255AbdDFS45 (ORCPT ); Thu, 6 Apr 2017 14:56:57 -0400 Received: by mail-it0-f43.google.com with SMTP id y18so107032819itc.0 for ; Thu, 06 Apr 2017 11:56:57 -0700 (PDT) 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; bh=lR9/u9qGKR2PsCBu5HH2cDTCS8Gbz+237nosURhO104=; b=W995hvOkzeYq38prv6v+KpLBfAtb+vz/JBY4vHgTv9pp6BipmWYhbRUxxXDlEs8Vep NzGuZZKqIFNOvpDIJWkwCY9HVf2H1Bxdm1QSaft57Q32Tmla4eI91/EIOYgBbjRBlAV7 OiC2mi428FyQcKQFVnP2EAFU00aMIHFpT60Nxb2nMKnTG2kIVjzwQv7aj+PQpLvhuAlt dQvAY7+5UkhazrzxqSyB8IIupES+ARwTFCVQS7YbTvIXAKe1156zsIT18chK7SeqUZ/5 TlmOvDYku8uP3zt+8FTC0K7UZ2CBtErF7W984X9I8apQDpnJoO9vdHKCTVhgC5S7rGMD wEmQ== X-Gm-Message-State: AFeK/H2p7r9JqipBT1RLWe4/4mdetkx2RstWEpDw6Fldonl4vWkc2zgDJ0UhXlgCLDsOlNQM X-Received: by 10.36.207.212 with SMTP id y203mr27242334itf.63.1491505016685; Thu, 06 Apr 2017 11:56:56 -0700 (PDT) Received: from mka.mtv.corp.google.com ([172.22.64.162]) by smtp.gmail.com with ESMTPSA id j193sm1315736ioe.59.2017.04.06.11.56.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 06 Apr 2017 11:56:56 -0700 (PDT) From: Matthias Kaehlcke To: Johannes Berg , "David S . Miller" Cc: linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, Grant Grundler , Michael Davidson , Greg Hackmann , Matthias Kaehlcke Subject: [PATCH] mac80211: Fix clang warning about constant operand in logical operation Date: Thu, 6 Apr 2017 11:56:33 -0700 Message-Id: <20170406185633.91065-1-mka@chromium.org> X-Mailer: git-send-email 2.12.2.715.g7642488e1d-goog 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 Clang raises a warning about the expression 'strlen(CONFIG_XXX)' being used in a logical operation. Clangs' builtin strlen function resolves the expression to a constant at compile time, which causes clang to generate a 'constant-logical-operand' warning. Split the if statement in two to avoid using the const expression in a logical operation. Signed-off-by: Matthias Kaehlcke --- net/mac80211/rate.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c index 206698bc93f4..68ff202d6380 100644 --- a/net/mac80211/rate.c +++ b/net/mac80211/rate.c @@ -173,9 +173,14 @@ ieee80211_rate_control_ops_get(const char *name) /* try default if specific alg requested but not found */ ops = ieee80211_try_rate_control_ops_get(ieee80211_default_rc_algo); + if (ops) + goto unlock; + /* try built-in one if specific alg requested but not found */ - if (!ops && strlen(CONFIG_MAC80211_RC_DEFAULT)) + if (strlen(CONFIG_MAC80211_RC_DEFAULT)) ops = ieee80211_try_rate_control_ops_get(CONFIG_MAC80211_RC_DEFAULT); + +unlock: kernel_param_unlock(THIS_MODULE); return ops;