netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rtlwifi: rtl8192se: remove redundant rtl_get_bbreg call
@ 2022-12-05  8:53 Peter Kosyh
  2022-12-06  2:01 ` Ping-Ke Shih
  2022-12-08 14:52 ` wifi: rtlwifi: rtl8192se: remove redundant rtl_get_bbreg() call Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: Peter Kosyh @ 2022-12-05  8:53 UTC (permalink / raw)
  To: Ping-Ke Shih
  Cc: Peter Kosyh, David S. Miller, Eric Dumazet, Kalle Valo,
	Jakub Kicinski, Paolo Abeni, linux-wireless, netdev,
	linux-kernel, lvc-project

Extra rtl_get_bbreg looks like redundant reading. The read has
already been done in the "else" branch. Compile test only.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Peter Kosyh <pkosyh@yandex.ru>
---
If this code is important for the operation of the hardware, then it would
be nice to comment on it.

 drivers/net/wireless/realtek/rtlwifi/rtl8192se/phy.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/phy.c
index aaa004d4d6d0..09591a0b5a81 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/phy.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/phy.c
@@ -115,9 +115,6 @@ static u32 _rtl92s_phy_rf_serial_read(struct ieee80211_hw *hw,
 		retvalue = rtl_get_bbreg(hw, pphyreg->rf_rb,
 					 BLSSI_READBACK_DATA);
 
-	retvalue = rtl_get_bbreg(hw, pphyreg->rf_rb,
-				 BLSSI_READBACK_DATA);
-
 	rtl_dbg(rtlpriv, COMP_RF, DBG_TRACE, "RFR-%d Addr[0x%x]=0x%x\n",
 		rfpath, pphyreg->rf_rb, retvalue);
 
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH] rtlwifi: rtl8192se: remove redundant rtl_get_bbreg call
  2022-12-05  8:53 [PATCH] rtlwifi: rtl8192se: remove redundant rtl_get_bbreg call Peter Kosyh
@ 2022-12-06  2:01 ` Ping-Ke Shih
  2022-12-08 14:52 ` wifi: rtlwifi: rtl8192se: remove redundant rtl_get_bbreg() call Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Ping-Ke Shih @ 2022-12-06  2:01 UTC (permalink / raw)
  To: Peter Kosyh
  Cc: David S. Miller, Eric Dumazet, Kalle Valo, Jakub Kicinski,
	Paolo Abeni, linux-wireless, netdev, linux-kernel, lvc-project


> -----Original Message-----
> From: Peter Kosyh <pkosyh@yandex.ru>
> Sent: Monday, December 5, 2022 4:54 PM
> To: Ping-Ke Shih <pkshih@realtek.com>
> Cc: Peter Kosyh <pkosyh@yandex.ru>; David S. Miller <davem@davemloft.net>; Eric Dumazet
> <edumazet@google.com>; Kalle Valo <kvalo@kernel.org>; Jakub Kicinski <kuba@kernel.org>; Paolo Abeni
> <pabeni@redhat.com>; linux-wireless@vger.kernel.org; netdev@vger.kernel.org;
> linux-kernel@vger.kernel.org; lvc-project@linuxtesting.org
> Subject: [PATCH] rtlwifi: rtl8192se: remove redundant rtl_get_bbreg call
> 
> Extra rtl_get_bbreg looks like redundant reading. The read has
> already been done in the "else" branch. Compile test only.

Originally, the code is 

01 if (rfpi_enable)
02     val = get_from_interface_A();
03 else
04    val = get_from_interface_B();
05
06 val = get_from_interface_B();

This patch is to remove line 06, and it looks like logic is changed. However,
'rfpi_enable' is decided by 0x820[8] and 0x828[8] set by rtl8192sephy_reg_2t2rarray[]
table, and 'rfpi_enable' is always false. I think this is why nobody can't
encounter problem and find this bug.

> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Signed-off-by: Peter Kosyh <pkosyh@yandex.ru>

Acked-by: Ping-Ke Shih <pkshih@realtek.com>

> ---
> If this code is important for the operation of the hardware, then it would
> be nice to comment on it.
> 
>  drivers/net/wireless/realtek/rtlwifi/rtl8192se/phy.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/phy.c
> b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/phy.c
> index aaa004d4d6d0..09591a0b5a81 100644
> --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/phy.c
> +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/phy.c
> @@ -115,9 +115,6 @@ static u32 _rtl92s_phy_rf_serial_read(struct ieee80211_hw *hw,
>  		retvalue = rtl_get_bbreg(hw, pphyreg->rf_rb,
>  					 BLSSI_READBACK_DATA);
> 
> -	retvalue = rtl_get_bbreg(hw, pphyreg->rf_rb,
> -				 BLSSI_READBACK_DATA);
> -
>  	rtl_dbg(rtlpriv, COMP_RF, DBG_TRACE, "RFR-%d Addr[0x%x]=0x%x\n",
>  		rfpath, pphyreg->rf_rb, retvalue);
> 
> --
> 2.38.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: wifi: rtlwifi: rtl8192se: remove redundant rtl_get_bbreg() call
  2022-12-05  8:53 [PATCH] rtlwifi: rtl8192se: remove redundant rtl_get_bbreg call Peter Kosyh
  2022-12-06  2:01 ` Ping-Ke Shih
@ 2022-12-08 14:52 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2022-12-08 14:52 UTC (permalink / raw)
  To: Peter Kosyh
  Cc: Ping-Ke Shih, Peter Kosyh, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, linux-wireless, netdev,
	linux-kernel, lvc-project

Peter Kosyh <pkosyh@yandex.ru> wrote:

> Extra rtl_get_bbreg() call looks like redundant reading. The read has
> already been done in the "else" branch. Compile test only.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Signed-off-by: Peter Kosyh <pkosyh@yandex.ru>
> Acked-by: Ping-Ke Shih <pkshih@realtek.com>

Patch applied to wireless-next.git, thanks.

49ebca0d9018 wifi: rtlwifi: rtl8192se: remove redundant rtl_get_bbreg() call

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20221205085342.677329-1-pkosyh@yandex.ru/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-12-08 14:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-05  8:53 [PATCH] rtlwifi: rtl8192se: remove redundant rtl_get_bbreg call Peter Kosyh
2022-12-06  2:01 ` Ping-Ke Shih
2022-12-08 14:52 ` wifi: rtlwifi: rtl8192se: remove redundant rtl_get_bbreg() call Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).