public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: Ping-Ke Shih <pkshih@realtek.com>
To: Chelsy Ratnawat <chelsyratnawat2001@gmail.com>
Cc: "johannes.berg@intel.com" <johannes.berg@intel.com>,
	"bhelgaas@google.com" <bhelgaas@google.com>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Subject: RE: [PATCH] rtlwifi: rtl8821ae: Remove dead code in rtl8821ae_update_hal_rate_table()
Date: Tue, 7 Apr 2026 00:45:41 +0000	[thread overview]
Message-ID: <f801f866b83c49cda398c7e167e48b51@realtek.com> (raw)
In-Reply-To: <20260403165416.131684-1-chelsyratnawat2001@gmail.com>

Chelsy Ratnawat <chelsyratnawat2001@gmail.com> wrote:
> Sent: Saturday, April 4, 2026 12:54 AM
> The variable 'mimo_ps' is initialized to IEEE80211_SMPS_OFF and never
> modified throughout the function. This makes the condition checking for
> IEEE80211_SMPS_STATIC always evaluate to false, rendering the entire
> if-branch unreachable dead code.
> 
> The error was reported by Coverity Scan.
> 
> Signed-off-by: Chelsy Ratnawat <chelsyratnawat2001@gmail.com>
> ---
>  .../wireless/realtek/rtlwifi/rtl8821ae/hw.c   | 19 +++++++------------
>  1 file changed, 7 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
> b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
> index 3a4a33476205..81d36041a79b 100644
> --- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
> +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
> @@ -3257,7 +3257,6 @@ static void rtl8821ae_update_hal_rate_table(struct ieee80211_hw *hw,
>         u32 ratr_value;
>         u8 ratr_index = 0;
>         u8 b_nmode = mac->ht_enable;
> -       u8 mimo_ps = IEEE80211_SMPS_OFF;
>         u16 shortgi_rate;
>         u32 tmp_ratr_value;
>         u8 curtxbw_40mhz = mac->bw_40;
> @@ -3288,19 +3287,15 @@ static void rtl8821ae_update_hal_rate_table(struct ieee80211_hw *hw,
>         case WIRELESS_MODE_N_24G:
>         case WIRELESS_MODE_N_5G:
>                 b_nmode = 1;
> -               if (mimo_ps == IEEE80211_SMPS_STATIC) {
> -                       ratr_value &= 0x0007F005;
> -               } else {
> -                       u32 ratr_mask;
> +               u32 ratr_mask;

Declare local variable at top of scope or function.

Otherwise, looks fine to me. 

> 
> -                       if (get_rf_type(rtlphy) == RF_1T2R ||
> -                           get_rf_type(rtlphy) == RF_1T1R)
> -                               ratr_mask = 0x000ff005;
> -                       else
> -                               ratr_mask = 0x0f0ff005;
> +               if (get_rf_type(rtlphy) == RF_1T2R ||
> +                   get_rf_type(rtlphy) == RF_1T1R)
> +                       ratr_mask = 0x000ff005;
> +               else
> +                       ratr_mask = 0x0f0ff005;
> 
> -                       ratr_value &= ratr_mask;
> -               }
> +               ratr_value &= ratr_mask;
>                 break;
>         default:
>                 if (rtlphy->rf_type == RF_1T2R)
> --
> 2.43.0


      reply	other threads:[~2026-04-07  0:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-03 16:54 [PATCH] rtlwifi: rtl8821ae: Remove dead code in rtl8821ae_update_hal_rate_table() Chelsy Ratnawat
2026-04-07  0:45 ` Ping-Ke Shih [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=f801f866b83c49cda398c7e167e48b51@realtek.com \
    --to=pkshih@realtek.com \
    --cc=bhelgaas@google.com \
    --cc=chelsyratnawat2001@gmail.com \
    --cc=johannes.berg@intel.com \
    --cc=linux-wireless@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