From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758246AbdJMNzr (ORCPT ); Fri, 13 Oct 2017 09:55:47 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:62277 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753447AbdJMNzp (ORCPT ); Fri, 13 Oct 2017 09:55:45 -0400 X-IronPort-AV: E=Sophos;i="5.43,371,1503352800"; d="scan'208";a="296096324" Date: Fri, 13 Oct 2017 15:55:39 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: Larry Finger cc: linux-kernel@vger.kernel.org, Greg Kroah-Hartman , kbuild-all@01.org Subject: Re: drivers/staging/rtlwifi/base.c:920:7-9: WARNING: possible condition with no effect (if == else) In-Reply-To: <201710132012.kptCgENA%fengguang.wu@intel.com> Message-ID: References: <201710132012.kptCgENA%fengguang.wu@intel.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It seems that the then and else branches of the conditions on lines 920 and 932 are the same. julia On Fri, 13 Oct 2017, kbuild test robot wrote: > CC: kbuild-all@01.org > CC: linux-kernel@vger.kernel.org > TO: Larry Finger > CC: "Greg Kroah-Hartman" > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master > head: 3d7882769b5dc929690f96e0c318c29b97f51018 > commit: 5b5ab4cb5cda824ef59e0511ac5d585f35f1a1a6 staging: r8822be: Add Makefiles and Kconfig for new driver > date: 8 weeks ago > :::::: branch date: 12 hours ago > :::::: commit date: 8 weeks ago > > >> drivers/staging/rtlwifi/base.c:920:7-9: WARNING: possible condition with no effect (if == else) > drivers/staging/rtlwifi/base.c:932:7-9: WARNING: possible condition with no effect (if == else) > > # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5b5ab4cb5cda824ef59e0511ac5d585f35f1a1a6 > git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git > git remote update linus > git checkout 5b5ab4cb5cda824ef59e0511ac5d585f35f1a1a6 > vim +920 drivers/staging/rtlwifi/base.c > > 56bde846 Ping-Ke Shih 2017-08-17 905 > 56bde846 Ping-Ke Shih 2017-08-17 906 static u8 _rtl_get_vht_highest_n_rate(struct ieee80211_hw *hw, > 56bde846 Ping-Ke Shih 2017-08-17 907 struct ieee80211_sta *sta) > 56bde846 Ping-Ke Shih 2017-08-17 908 { > 56bde846 Ping-Ke Shih 2017-08-17 909 struct rtl_priv *rtlpriv = rtl_priv(hw); > 56bde846 Ping-Ke Shih 2017-08-17 910 struct rtl_phy *rtlphy = &rtlpriv->phy; > 56bde846 Ping-Ke Shih 2017-08-17 911 u8 hw_rate; > 56bde846 Ping-Ke Shih 2017-08-17 912 u16 tx_mcs_map = le16_to_cpu(sta->vht_cap.vht_mcs.tx_mcs_map); > 56bde846 Ping-Ke Shih 2017-08-17 913 > 56bde846 Ping-Ke Shih 2017-08-17 914 if ((get_rf_type(rtlphy) == RF_2T2R) && > 56bde846 Ping-Ke Shih 2017-08-17 915 (tx_mcs_map & 0x000c) != 0x000c) { > 56bde846 Ping-Ke Shih 2017-08-17 916 if ((tx_mcs_map & 0x000c) >> 2 == > 56bde846 Ping-Ke Shih 2017-08-17 917 IEEE80211_VHT_MCS_SUPPORT_0_7) > 56bde846 Ping-Ke Shih 2017-08-17 918 hw_rate = > 56bde846 Ping-Ke Shih 2017-08-17 919 rtlpriv->cfg->maps[RTL_RC_VHT_RATE_2SS_MCS7]; > 56bde846 Ping-Ke Shih 2017-08-17 @920 else if ((tx_mcs_map & 0x000c) >> 2 == > 56bde846 Ping-Ke Shih 2017-08-17 921 IEEE80211_VHT_MCS_SUPPORT_0_8) > 56bde846 Ping-Ke Shih 2017-08-17 922 hw_rate = > 56bde846 Ping-Ke Shih 2017-08-17 923 rtlpriv->cfg->maps[RTL_RC_VHT_RATE_2SS_MCS9]; > 56bde846 Ping-Ke Shih 2017-08-17 924 else > 56bde846 Ping-Ke Shih 2017-08-17 925 hw_rate = > 56bde846 Ping-Ke Shih 2017-08-17 926 rtlpriv->cfg->maps[RTL_RC_VHT_RATE_2SS_MCS9]; > 56bde846 Ping-Ke Shih 2017-08-17 927 } else { > 56bde846 Ping-Ke Shih 2017-08-17 928 if ((tx_mcs_map & 0x0003) == > 56bde846 Ping-Ke Shih 2017-08-17 929 IEEE80211_VHT_MCS_SUPPORT_0_7) > 56bde846 Ping-Ke Shih 2017-08-17 930 hw_rate = > 56bde846 Ping-Ke Shih 2017-08-17 931 rtlpriv->cfg->maps[RTL_RC_VHT_RATE_1SS_MCS7]; > 56bde846 Ping-Ke Shih 2017-08-17 932 else if ((tx_mcs_map & 0x0003) == > 56bde846 Ping-Ke Shih 2017-08-17 933 IEEE80211_VHT_MCS_SUPPORT_0_8) > 56bde846 Ping-Ke Shih 2017-08-17 934 hw_rate = > 56bde846 Ping-Ke Shih 2017-08-17 935 rtlpriv->cfg->maps[RTL_RC_VHT_RATE_1SS_MCS9]; > 56bde846 Ping-Ke Shih 2017-08-17 936 else > 56bde846 Ping-Ke Shih 2017-08-17 937 hw_rate = > 56bde846 Ping-Ke Shih 2017-08-17 938 rtlpriv->cfg->maps[RTL_RC_VHT_RATE_1SS_MCS9]; > 56bde846 Ping-Ke Shih 2017-08-17 939 } > 56bde846 Ping-Ke Shih 2017-08-17 940 > 56bde846 Ping-Ke Shih 2017-08-17 941 return hw_rate; > 56bde846 Ping-Ke Shih 2017-08-17 942 } > 56bde846 Ping-Ke Shih 2017-08-17 943 > > :::::: The code at line 920 was first introduced by commit > :::::: 56bde846304ea05d5f8c8de0e3a42627a7a92be6 staging: r8822be: Add existing rtlwifi and rtl_pci parts for new driver > > :::::: TO: Ping-Ke Shih > :::::: CC: Greg Kroah-Hartman > > --- > 0-DAY kernel test infrastructure Open Source Technology Center > https://lists.01.org/pipermail/kbuild-all Intel Corporation >