mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: Larry Finger <Larry.Finger@lwfinger.net>
Cc: linux-kernel@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	kbuild-all@01.org
Subject: Re: drivers/staging/rtlwifi/base.c:920:7-9: WARNING: possible condition with no effect (if == else)
Date: Fri, 13 Oct 2017 23:48:25 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1710132344590.3147@hadrien> (raw)
In-Reply-To: <9449a43b-2e02-f326-f5b1-7a55852ccb5b@lwfinger.net>



On Fri, 13 Oct 2017, Larry Finger wrote:

> Julia,
>
> On 10/13/2017 08:55 AM, Julia Lawall wrote:
> > It seems that the then and else branches of the conditions on lines 920
> > and 932 are the same.
>
> I think line 923 should be using RTL_RC_VHT_RATE_2SS_MCS8 rather than
> RTL_RC_VHT_RATE_2SS_MCS9, but I have sent an inquiry to my contact at Realtek
> to check.

OK, thanks.  The realtek code has a surprisingly large number of these
kinds of problems, for example, the following from
(drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c):

		if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
		    (wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
			btc8723b2ant_sw_mechanism(btcoexist, true, false,
						  false, false);
		} else {
			btc8723b2ant_sw_mechanism(btcoexist, true, false,
						  false, false);
		}

I wondered if the code is generated, and the generator has a policy of
just doing the last "then" branch if all of the known tests fail.

I could send a complete list of such issues, if they are of interest.

julia

>
> Thanks,
>
> Larry
>
> > On Fri, 13 Oct 2017, kbuild test robot wrote:
> >
> > > CC: kbuild-all@01.org
> > > CC: linux-kernel@vger.kernel.org
> > > TO: Larry Finger <Larry.Finger@lwfinger.net>
> > > CC: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
> > >
> > > 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 <pkshih@realtek.com>
> > > :::::: CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > >
> > > ---
> > > 0-DAY kernel test infrastructure                Open Source Technology
> > > Center
> > > https://lists.01.org/pipermail/kbuild-all                   Intel
> > > Corporation
> > >
> >
>
>

      reply	other threads:[~2017-10-13 21:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <201710132012.kptCgENA%fengguang.wu@intel.com>
2017-10-13 13:55 ` Julia Lawall
2017-10-13 18:11   ` Larry Finger
2017-10-13 21:48     ` Julia Lawall [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.20.1710132344590.3147@hadrien \
    --to=julia.lawall@lip6.fr \
    --cc=Larry.Finger@lwfinger.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=kbuild-all@01.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®