Linux kernel staging patches
 help / color / mirror / Atom feed
* [PATCH v2 0/4] staging: fix warning of -Wunused-but-set-variable reported by clang
@ 2024-09-13  0:28 Ping-Ke Shih
  2024-09-13  0:28 ` [PATCH v2 1/4] staging: rtl8712: remove unused drvinfo_sz from update_recvframe_attrib Ping-Ke Shih
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Ping-Ke Shih @ 2024-09-13  0:28 UTC (permalink / raw)
  To: linux-staging

The build of wireless-next pull-request using clang report warnings [1].
Fix them accordingly.

[1] https://lore.kernel.org/linux-wireless/172609384625.1065358.6518424528532813444.git-patchwork-notify@kernel.org/T/#m405a10ad637bfc5f337127bab81336d8569e49cd

v2:
 - rebase to top of staging tree to resolve conflict of patch 2/4.
 - no logic change.

Ping-Ke Shih (4):
  staging: rtl8712: remove unused drvinfo_sz from
    update_recvframe_attrib
  staging: rtl8723bs: remove unused efuseValue from efuse_OneByteWrite()
  staging: rtl8723bs: remove unused cnt from recv_func()
  staging: rtl8723bs: remove unused 'poll_cnt' from rtw_set_rpwm()

 drivers/staging/rtl8712/rtl8712_recv.c       | 4 ----
 drivers/staging/rtl8723bs/core/rtw_efuse.c   | 9 ---------
 drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 2 --
 drivers/staging/rtl8723bs/core/rtw_recv.c    | 5 +----
 4 files changed, 1 insertion(+), 19 deletions(-)

-- 
2.25.1


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

* [PATCH v2 1/4] staging: rtl8712: remove unused drvinfo_sz from update_recvframe_attrib
  2024-09-13  0:28 [PATCH v2 0/4] staging: fix warning of -Wunused-but-set-variable reported by clang Ping-Ke Shih
@ 2024-09-13  0:28 ` Ping-Ke Shih
  2024-09-13  0:28 ` [PATCH v2 2/4] staging: rtl8723bs: remove unused efuseValue from efuse_OneByteWrite() Ping-Ke Shih
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Ping-Ke Shih @ 2024-09-13  0:28 UTC (permalink / raw)
  To: linux-staging

The drvinfo_sz is a size of hardware generated data putting in front of
real RX data. The functions r8712_rxcmd_event_hdl() and recvbuf2recvframe()
have its own parsing code to get drvinfo_sz to access real RX data, so
removing this unused drvinfo_sz is safe.

Otherwise, clang report:

rtl8712_recv.c:139:6: warning:
	variable 'drvinfo_sz' set but not used [-Wunused-but-set-variable]
  139 |         u16 drvinfo_sz;
      |             ^

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 drivers/staging/rtl8712/rtl8712_recv.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c
index 1fabc5137a4c..ab344d676bb9 100644
--- a/drivers/staging/rtl8712/rtl8712_recv.c
+++ b/drivers/staging/rtl8712/rtl8712_recv.c
@@ -136,10 +136,6 @@ void r8712_free_recvframe(union recv_frame *precvframe,
 static void update_recvframe_attrib_from_recvstat(struct rx_pkt_attrib *pattrib,
 						  struct recv_stat *prxstat)
 {
-	u16 drvinfo_sz;
-
-	drvinfo_sz = (le32_to_cpu(prxstat->rxdw0) & 0x000f0000) >> 16;
-	drvinfo_sz <<= 3;
 	/*TODO:
 	 * Offset 0
 	 */
-- 
2.25.1


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

* [PATCH v2 2/4] staging: rtl8723bs: remove unused efuseValue from efuse_OneByteWrite()
  2024-09-13  0:28 [PATCH v2 0/4] staging: fix warning of -Wunused-but-set-variable reported by clang Ping-Ke Shih
  2024-09-13  0:28 ` [PATCH v2 1/4] staging: rtl8712: remove unused drvinfo_sz from update_recvframe_attrib Ping-Ke Shih
@ 2024-09-13  0:28 ` Ping-Ke Shih
  2024-09-13  0:28 ` [PATCH v2 3/4] staging: rtl8723bs: remove unused cnt from recv_func() Ping-Ke Shih
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Ping-Ke Shih @ 2024-09-13  0:28 UTC (permalink / raw)
  To: linux-staging

The efuseValue is to store value from register EFUSE_CTRL, and set control
bits including address and write bit. This is no need for RTL8723BS, so
the consumer has been removed. Thus, remove these unused codes are safe.

Otherwiese, clang warns:

rtw_efuse.c:285:6: warning:
	 variable 'efuseValue' set but not used [-Wunused-but-set-variable]
  285 |         u32 efuseValue;
      |             ^

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 drivers/staging/rtl8723bs/core/rtw_efuse.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_efuse.c b/drivers/staging/rtl8723bs/core/rtw_efuse.c
index 6419638c6e20..8b671f8a7965 100644
--- a/drivers/staging/rtl8723bs/core/rtw_efuse.c
+++ b/drivers/staging/rtl8723bs/core/rtw_efuse.c
@@ -281,22 +281,13 @@ u8 efuse_OneByteWrite(struct adapter *padapter, u16 addr, u8 data, bool bPseudoT
 {
 	u8 tmpidx = 0;
 	u8 bResult = false;
-	u32 efuseValue;
 
 	if (bPseudoTest)
 		return Efuse_Write1ByteToFakeContent(addr, data);
 
-
 	/*  -----------------e-fuse reg ctrl --------------------------------- */
 	/* address */
 
-
-	efuseValue = rtw_read32(padapter, EFUSE_CTRL);
-	efuseValue |= (BIT21 | BIT31);
-	efuseValue &= ~(0x3FFFF);
-	efuseValue |= ((addr << 8 | data) & 0x3FFFF);
-
-
 	/*  <20130227, Kordan> 8192E MP chip A-cut had better not set 0x34[11] until B-Cut. */
 
 	/*  <20130121, Kordan> For SMIC EFUSE specificatoin. */
-- 
2.25.1


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

* [PATCH v2 3/4] staging: rtl8723bs: remove unused cnt from recv_func()
  2024-09-13  0:28 [PATCH v2 0/4] staging: fix warning of -Wunused-but-set-variable reported by clang Ping-Ke Shih
  2024-09-13  0:28 ` [PATCH v2 1/4] staging: rtl8712: remove unused drvinfo_sz from update_recvframe_attrib Ping-Ke Shih
  2024-09-13  0:28 ` [PATCH v2 2/4] staging: rtl8723bs: remove unused efuseValue from efuse_OneByteWrite() Ping-Ke Shih
@ 2024-09-13  0:28 ` Ping-Ke Shih
  2024-09-13  0:28 ` [PATCH v2 4/4] staging: rtl8723bs: remove unused 'poll_cnt' from rtw_set_rpwm() Ping-Ke Shih
  2024-09-13  4:48 ` [PATCH v2 0/4] staging: fix warning of -Wunused-but-set-variable reported by clang Philipp Hortmann
  4 siblings, 0 replies; 6+ messages in thread
From: Ping-Ke Shih @ 2024-09-13  0:28 UTC (permalink / raw)
  To: linux-staging

The 'cnt' is used to show how many pending frames are processed, and the
debug code has been removed, so removing 'cnt' is safe.

Otherwise, clang warns:

core/rtw_recv.c:2030:7: warning:
	 variable 'cnt' set but not used [-Wunused-but-set-variable]
 2030 |                 int cnt = 0;
      |                     ^

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 drivers/staging/rtl8723bs/core/rtw_recv.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_recv.c b/drivers/staging/rtl8723bs/core/rtw_recv.c
index 7a95e15e641f..b30f026789b6 100644
--- a/drivers/staging/rtl8723bs/core/rtw_recv.c
+++ b/drivers/staging/rtl8723bs/core/rtw_recv.c
@@ -2026,12 +2026,9 @@ static int recv_func(struct adapter *padapter, union recv_frame *rframe)
 	/* check if need to handle uc_swdec_pending_queue*/
 	if (check_fwstate(mlmepriv, WIFI_STATION_STATE) && psecuritypriv->busetkipkey) {
 		union recv_frame *pending_frame;
-		int cnt = 0;
 
-		while ((pending_frame = rtw_alloc_recvframe(&padapter->recvpriv.uc_swdec_pending_queue))) {
-			cnt++;
+		while ((pending_frame = rtw_alloc_recvframe(&padapter->recvpriv.uc_swdec_pending_queue)))
 			recv_func_posthandle(padapter, pending_frame);
-		}
 	}
 
 	ret = recv_func_prehandle(padapter, rframe);
-- 
2.25.1


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

* [PATCH v2 4/4] staging: rtl8723bs: remove unused 'poll_cnt' from rtw_set_rpwm()
  2024-09-13  0:28 [PATCH v2 0/4] staging: fix warning of -Wunused-but-set-variable reported by clang Ping-Ke Shih
                   ` (2 preceding siblings ...)
  2024-09-13  0:28 ` [PATCH v2 3/4] staging: rtl8723bs: remove unused cnt from recv_func() Ping-Ke Shih
@ 2024-09-13  0:28 ` Ping-Ke Shih
  2024-09-13  4:48 ` [PATCH v2 0/4] staging: fix warning of -Wunused-but-set-variable reported by clang Philipp Hortmann
  4 siblings, 0 replies; 6+ messages in thread
From: Ping-Ke Shih @ 2024-09-13  0:28 UTC (permalink / raw)
  To: linux-staging

The 'poll_cnt' is used to assist in polling hardware state. Current code
uses jiffies to determine timeout, so removing this value is safe.

Otherwise, clang warns:

core/rtw_pwrctrl.c:288:6: warning:
	 variable 'poll_cnt' set but not used [-Wunused-but-set-variable]
  288 |                 u8 poll_cnt = 0;
      |                    ^

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
index a95092129748..dbfcbac3d855 100644
--- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
+++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
@@ -284,14 +284,12 @@ void rtw_set_rpwm(struct adapter *padapter, u8 pslv)
 	if (rpwm & PS_ACK) {
 		unsigned long start_time;
 		u8 cpwm_now;
-		u8 poll_cnt = 0;
 
 		start_time = jiffies;
 
 		/*  polling cpwm */
 		do {
 			mdelay(1);
-			poll_cnt++;
 			rtw_hal_get_hwreg(padapter, HW_VAR_CPWM, &cpwm_now);
 			if ((cpwm_orig ^ cpwm_now) & 0x80) {
 				pwrpriv->cpwm = PS_STATE_S4;
-- 
2.25.1


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

* Re: [PATCH v2 0/4] staging: fix warning of -Wunused-but-set-variable reported by clang
  2024-09-13  0:28 [PATCH v2 0/4] staging: fix warning of -Wunused-but-set-variable reported by clang Ping-Ke Shih
                   ` (3 preceding siblings ...)
  2024-09-13  0:28 ` [PATCH v2 4/4] staging: rtl8723bs: remove unused 'poll_cnt' from rtw_set_rpwm() Ping-Ke Shih
@ 2024-09-13  4:48 ` Philipp Hortmann
  4 siblings, 0 replies; 6+ messages in thread
From: Philipp Hortmann @ 2024-09-13  4:48 UTC (permalink / raw)
  To: Ping-Ke Shih, linux-staging

On 9/13/24 02:28, Ping-Ke Shih wrote:
> The build of wireless-next pull-request using clang report warnings [1].
> Fix them accordingly.
> 
> [1] https://lore.kernel.org/linux-wireless/172609384625.1065358.6518424528532813444.git-patchwork-notify@kernel.org/T/#m405a10ad637bfc5f337127bab81336d8569e49cd
> 
> v2:
>   - rebase to top of staging tree to resolve conflict of patch 2/4.
>   - no logic change.
> 
> Ping-Ke Shih (4):
>    staging: rtl8712: remove unused drvinfo_sz from
>      update_recvframe_attrib
>    staging: rtl8723bs: remove unused efuseValue from efuse_OneByteWrite()
>    staging: rtl8723bs: remove unused cnt from recv_func()
>    staging: rtl8723bs: remove unused 'poll_cnt' from rtw_set_rpwm()
> 
>   drivers/staging/rtl8712/rtl8712_recv.c       | 4 ----
>   drivers/staging/rtl8723bs/core/rtw_efuse.c   | 9 ---------
>   drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 2 --
>   drivers/staging/rtl8723bs/core/rtw_recv.c    | 5 +----
>   4 files changed, 1 insertion(+), 19 deletions(-)
> 


Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>

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

end of thread, other threads:[~2024-09-13  4:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-13  0:28 [PATCH v2 0/4] staging: fix warning of -Wunused-but-set-variable reported by clang Ping-Ke Shih
2024-09-13  0:28 ` [PATCH v2 1/4] staging: rtl8712: remove unused drvinfo_sz from update_recvframe_attrib Ping-Ke Shih
2024-09-13  0:28 ` [PATCH v2 2/4] staging: rtl8723bs: remove unused efuseValue from efuse_OneByteWrite() Ping-Ke Shih
2024-09-13  0:28 ` [PATCH v2 3/4] staging: rtl8723bs: remove unused cnt from recv_func() Ping-Ke Shih
2024-09-13  0:28 ` [PATCH v2 4/4] staging: rtl8723bs: remove unused 'poll_cnt' from rtw_set_rpwm() Ping-Ke Shih
2024-09-13  4:48 ` [PATCH v2 0/4] staging: fix warning of -Wunused-but-set-variable reported by clang Philipp Hortmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox