public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Larry Finger <Larry.Finger@lwfinger.net>
To: "Gustavo A. R. Silva" <gustavo@embeddedor.com>,
	Chaoming Li <chaoming_li@realsil.com.cn>,
	Kalle Valo <kvalo@codeaurora.org>
Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rtlwifi: refactor code in halbtcoutsrc module
Date: Thu, 31 Aug 2017 10:25:30 -0500	[thread overview]
Message-ID: <08aeadde-8a44-c49f-bc64-5b91226d4cec@lwfinger.net> (raw)
In-Reply-To: <20170830164602.GA16413@embeddedgus>

On 08/30/2017 11:46 AM, Gustavo A. R. Silva wrote:
> Function halbtc_get_wifi_rssi always returns rtlpriv->dm.undec_sm_pwdb.
> So this function can be removed and the value of
> rtlpriv->dm.undec_sm_pwdb assigned to *s32_tmp directly.
> 
> This issue was first reported by Coverity as "identical code for different
> branches" in function halbtc_get_wifi_rssi.
> 
> Addresses-Coverity-ID: 1226793
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> ---
> This code was reported by Coverity and it was tested by compilation only.
> Chances are this may be a copy/paste error in function
> halbtc_get_wifi_rssi. Please, verify.
> Also, notice this code has been there since 2014.

The value of *s32_tmp is not dependent on the link state, thus this patch is 
correct, but I request that it be changed. Future developments will modify 
halbtc_get_wifi_rssi() making it more complicated and not as easily inlined as 
this patch. In short, if you remove it here, we will have to add it later.

Thanks,

Larrt

> 
>   .../net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c   | 13 +------------
>   1 file changed, 1 insertion(+), 12 deletions(-)
> 
> diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
> index c1eacd8..2a47b97 100644
> --- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
> +++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
> @@ -373,17 +373,6 @@ u32 halbtc_get_wifi_link_status(struct btc_coexist *btcoexist)
>   	return ret_val;
>   }
>   
> -static s32 halbtc_get_wifi_rssi(struct rtl_priv *rtlpriv)
> -{
> -	int undec_sm_pwdb = 0;
> -
> -	if (rtlpriv->mac80211.link_state >= MAC80211_LINKED)
> -		undec_sm_pwdb = rtlpriv->dm.undec_sm_pwdb;
> -	else /* associated entry pwdb */
> -		undec_sm_pwdb = rtlpriv->dm.undec_sm_pwdb;
> -	return undec_sm_pwdb;
> -}
> -
>   static bool halbtc_get(void *void_btcoexist, u8 get_type, void *out_buf)
>   {
>   	struct btc_coexist *btcoexist = (struct btc_coexist *)void_btcoexist;
> @@ -479,7 +468,7 @@ static bool halbtc_get(void *void_btcoexist, u8 get_type, void *out_buf)
>   		*bool_tmp = false;
>   		break;
>   	case BTC_GET_S4_WIFI_RSSI:
> -		*s32_tmp = halbtc_get_wifi_rssi(rtlpriv);
> +		*s32_tmp = rtlpriv->dm.undec_sm_pwdb;
>   		break;
>   	case BTC_GET_S4_HS_RSSI:
>   		*s32_tmp = 0;
> 

      reply	other threads:[~2017-08-31 15:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-30 16:46 [PATCH] rtlwifi: refactor code in halbtcoutsrc module Gustavo A. R. Silva
2017-08-31 15:25 ` Larry Finger [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=08aeadde-8a44-c49f-bc64-5b91226d4cec@lwfinger.net \
    --to=larry.finger@lwfinger.net \
    --cc=chaoming_li@realsil.com.cn \
    --cc=gustavo@embeddedor.com \
    --cc=kvalo@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@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