2021-08-03 23:27:28

by Nathan Chancellor

[permalink] [raw]
Subject: [PATCH 0/4] staging: r8188eu: Fix clang warnings

This series cleans up all of the clang warnings that I noticed with
x86_64 allmodconfig on the current staging-next. This has been build
tested with both clang and gcc with x86_64 allmodconfig.

Nathan Chancellor (4):
staging: r8188eu: Remove _rtw_spinlock_free()
staging: r8188eu: Remove unnecessary parentheses
staging: r8188eu: Remove self assignment in get_rx_power_val_by_reg()
staging: r8188eu: Remove pointless NULL check in
rtw_check_join_candidate()

drivers/staging/r8188eu/core/rtw_cmd.c | 2 -
drivers/staging/r8188eu/core/rtw_mlme.c | 18 +----
drivers/staging/r8188eu/core/rtw_pwrctrl.c | 2 +-
drivers/staging/r8188eu/core/rtw_recv.c | 11 ---
drivers/staging/r8188eu/core/rtw_security.c | 4 +-
drivers/staging/r8188eu/core/rtw_sta_mgt.c | 77 -------------------
drivers/staging/r8188eu/core/rtw_wlan_util.c | 2 +-
drivers/staging/r8188eu/core/rtw_xmit.c | 19 -----
drivers/staging/r8188eu/hal/odm.c | 2 +-
drivers/staging/r8188eu/hal/rtl8188e_rf6052.c | 2 -
drivers/staging/r8188eu/hal/usb_halinit.c | 2 +-
.../staging/r8188eu/include/osdep_service.h | 1 -
drivers/staging/r8188eu/os_dep/os_intfs.c | 2 -
.../staging/r8188eu/os_dep/osdep_service.c | 4 -
14 files changed, 9 insertions(+), 139 deletions(-)


base-commit: 11e14fc3e49481b6322bbd976bb7dd2f0d7ef3d2
--
2.33.0.rc0



2021-08-05 11:14:24

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 0/4] staging: r8188eu: Fix clang warnings

On Tue, Aug 03, 2021 at 03:36:05PM -0700, Nathan Chancellor wrote:
> This series cleans up all of the clang warnings that I noticed with
> x86_64 allmodconfig on the current staging-next. This has been build
> tested with both clang and gcc with x86_64 allmodconfig.

Can you rebase on my staging-testing branch and resend this series?
There is a lot of churn in this driver right now, and your series does
not apply anymore.

thanks,

greg k-h

2021-08-05 20:51:47

by Nathan Chancellor

[permalink] [raw]
Subject: [PATCH v2 0/3] staging: r8188eu: Fix clang warnings

This series cleans up all of the clang warnings that I noticed with
x86_64 allmodconfig on the current staging-testing. This has been build
tested with both clang and gcc with x86_64 allmodconfig.

v1 -> v2:

* Rebase on staging-testing and fix conflict in patch 2.

* Drop patch 1 as it has already been fixed with commit 1c10f2b95cc1
("staging: r8188eu: Remove all calls to _rtw_spinlock_free()") and
follow-ups.

* Pick up Nick's reviewed-by tag for patches 1 and 2.

Nathan Chancellor (3):
staging: r8188eu: Remove unnecessary parentheses
staging: r8188eu: Remove self assignment in get_rx_power_val_by_reg()
staging: r8188eu: Remove pointless NULL check in
rtw_check_join_candidate()

drivers/staging/r8188eu/core/rtw_mlme.c | 2 +-
drivers/staging/r8188eu/core/rtw_pwrctrl.c | 2 +-
drivers/staging/r8188eu/core/rtw_security.c | 4 ++--
drivers/staging/r8188eu/core/rtw_wlan_util.c | 2 +-
drivers/staging/r8188eu/hal/odm.c | 2 +-
drivers/staging/r8188eu/hal/rtl8188e_rf6052.c | 2 --
drivers/staging/r8188eu/hal/usb_halinit.c | 2 +-
7 files changed, 7 insertions(+), 9 deletions(-)


base-commit: d48401b8609ff19db0f461759ac6b5210cd81288
--
2.33.0.rc0

2021-08-06 00:43:17

by Nathan Chancellor

[permalink] [raw]
Subject: [PATCH v2 1/3] staging: r8188eu: Remove unnecessary parentheses

Clang warns several times across the driver along the lines of:

drivers/staging/r8188eu/core/rtw_pwrctrl.c:222:21: warning: equality
comparison with extraneous parentheses [-Wparentheses-equality]
if ((pwrpriv->rpwm == pslv)) {
~~~~~~~~~~~~~~^~~~~~~
drivers/staging/r8188eu/core/rtw_pwrctrl.c:222:21: note: remove
extraneous parentheses around the comparison to silence this warning
if ((pwrpriv->rpwm == pslv)) {
~ ^ ~
drivers/staging/r8188eu/core/rtw_pwrctrl.c:222:21: note: use '=' to turn
this equality comparison into an assignment
if ((pwrpriv->rpwm == pslv)) {
^~
=
1 warning generated.

The compilers have agreed that single parentheses are used for equality
and double parentheses are used for assignment within control flow
statements such as if and while so remove them in these places to fix
the warning.

Signed-off-by: Nathan Chancellor <[email protected]>
Reviewed-by: Nick Desaulniers <[email protected]>
---
drivers/staging/r8188eu/core/rtw_pwrctrl.c | 2 +-
drivers/staging/r8188eu/core/rtw_security.c | 4 ++--
drivers/staging/r8188eu/core/rtw_wlan_util.c | 2 +-
drivers/staging/r8188eu/hal/odm.c | 2 +-
drivers/staging/r8188eu/hal/usb_halinit.c | 2 +-
5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_pwrctrl.c b/drivers/staging/r8188eu/core/rtw_pwrctrl.c
index 2c029f85d63d..967c9623e7d1 100644
--- a/drivers/staging/r8188eu/core/rtw_pwrctrl.c
+++ b/drivers/staging/r8188eu/core/rtw_pwrctrl.c
@@ -218,7 +218,7 @@ void rtw_set_rpwm(struct adapter *padapter, u8 pslv)
pslv = PS_STATE_S3;
}

- if ((pwrpriv->rpwm == pslv))
+ if (pwrpriv->rpwm == pslv)
return;

if ((padapter->bSurpriseRemoved) ||
diff --git a/drivers/staging/r8188eu/core/rtw_security.c b/drivers/staging/r8188eu/core/rtw_security.c
index df8107a0f5f2..08a5a1975d11 100644
--- a/drivers/staging/r8188eu/core/rtw_security.c
+++ b/drivers/staging/r8188eu/core/rtw_security.c
@@ -1209,7 +1209,7 @@ u32 rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe)
pframe = ((struct xmit_frame *)pxmitframe)->buf_addr + hw_hdr_offset;

/* 4 start to encrypt each fragment */
- if ((pattrib->encrypt == _AES_)) {
+ if (pattrib->encrypt == _AES_) {
if (pattrib->psta)
stainfo = pattrib->psta;
else
@@ -1452,7 +1452,7 @@ u32 rtw_aes_decrypt(struct adapter *padapter, u8 *precvframe)

pframe = (unsigned char *)((struct recv_frame *)precvframe)->rx_data;
/* 4 start to encrypt each fragment */
- if ((prxattrib->encrypt == _AES_)) {
+ if (prxattrib->encrypt == _AES_) {
stainfo = rtw_get_stainfo(&padapter->stapriv, &prxattrib->ta[0]);
if (stainfo) {
RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("rtw_aes_decrypt: stainfo!= NULL!!!\n"));
diff --git a/drivers/staging/r8188eu/core/rtw_wlan_util.c b/drivers/staging/r8188eu/core/rtw_wlan_util.c
index 5a9a824dcbfd..21a3d0868214 100644
--- a/drivers/staging/r8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/r8188eu/core/rtw_wlan_util.c
@@ -1283,7 +1283,7 @@ int support_short_GI(struct adapter *padapter, struct HT_caps_element *pHT_caps)
if (!(pmlmeinfo->HT_enable))
return _FAIL;

- if ((pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_RALINK))
+ if (pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_RALINK)
return _FAIL;

bit_offset = (pmlmeext->cur_bwmode & HT_CHANNEL_WIDTH_40) ? 6 : 5;
diff --git a/drivers/staging/r8188eu/hal/odm.c b/drivers/staging/r8188eu/hal/odm.c
index 08ec1e18b3f0..0deeb21c8006 100644
--- a/drivers/staging/r8188eu/hal/odm.c
+++ b/drivers/staging/r8188eu/hal/odm.c
@@ -1630,7 +1630,7 @@ void odm_EdcaTurboCheckCE(struct odm_dm_struct *pDM_Odm)
struct mlme_ext_priv *pmlmeext = &(Adapter->mlmeextpriv);
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);

- if ((pregpriv->wifi_spec == 1))/* (pmlmeinfo->HT_enable == 0)) */
+ if (pregpriv->wifi_spec == 1)
goto dm_CheckEdcaTurbo_EXIT;

if (pmlmeinfo->assoc_AP_vendor >= HT_IOT_PEER_MAX)
diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c
index b214b7b1e9de..c2d9c0359e64 100644
--- a/drivers/staging/r8188eu/hal/usb_halinit.c
+++ b/drivers/staging/r8188eu/hal/usb_halinit.c
@@ -1277,7 +1277,7 @@ static void hw_var_set_opmode(struct adapter *Adapter, u8 variable, u8 *val)
StopTxBeacon(Adapter);

rtw_write8(Adapter, REG_BCN_CTRL, 0x19);/* disable atim wnd */
- } else if ((mode == _HW_STATE_ADHOC_)) {
+ } else if (mode == _HW_STATE_ADHOC_) {
ResumeTxBeacon(Adapter);
rtw_write8(Adapter, REG_BCN_CTRL, 0x1a);
} else if (mode == _HW_STATE_AP_) {
--
2.33.0.rc0

2021-08-06 00:44:39

by Nathan Chancellor

[permalink] [raw]
Subject: [PATCH v2 2/3] staging: r8188eu: Remove self assignment in get_rx_power_val_by_reg()

Clang warns:

drivers/staging/r8188eu/hal/rtl8188e_rf6052.c:344:13: warning:
explicitly assigning value of variable of type 'u32' (aka 'unsigned
int') to itself [-Wself-assign]
writeVal = writeVal;
~~~~~~~~ ^ ~~~~~~~~
1 warning generated.

Remove this branch as it is useless.

Signed-off-by: Nathan Chancellor <[email protected]>
Reviewed-by: Nick Desaulniers <[email protected]>
---
drivers/staging/r8188eu/hal/rtl8188e_rf6052.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c b/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c
index 335b120ce603..77889dc05858 100644
--- a/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c
+++ b/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c
@@ -340,8 +340,6 @@ static void get_rx_power_val_by_reg(struct adapter *Adapter, u8 Channel,
/* This mechanism is only applied when Driver-Highpower-Mechanism is OFF. */
if (pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_BT1)
writeVal = writeVal - 0x06060606;
- else if (pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_BT2)
- writeVal = writeVal;
*(pOutWriteVal+rf) = writeVal;
}
}
--
2.33.0.rc0

2021-08-06 01:07:30

by Nathan Chancellor

[permalink] [raw]
Subject: [PATCH v2 3/3] staging: r8188eu: Remove pointless NULL check in rtw_check_join_candidate()

Clang warns:

drivers/staging/r8188eu/core/rtw_mlme.c:1629:28: warning: address of
array 'pmlmepriv->assoc_ssid.Ssid' will always evaluate to 'true'
[-Wpointer-bool-conversion]
if (pmlmepriv->assoc_ssid.Ssid && pmlmepriv->assoc_ssid.SsidLength) {
~~~~~~~~~~~~~~~~~~~~~~^~~~ ~~
1 warning generated.

Ssid is an array not at the beginning of a struct so its address cannot
be NULL so remove the check.

Signed-off-by: Nathan Chancellor <[email protected]>
---
drivers/staging/r8188eu/core/rtw_mlme.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/r8188eu/core/rtw_mlme.c b/drivers/staging/r8188eu/core/rtw_mlme.c
index e3d5a721d25c..95b952871e67 100644
--- a/drivers/staging/r8188eu/core/rtw_mlme.c
+++ b/drivers/staging/r8188eu/core/rtw_mlme.c
@@ -1622,7 +1622,7 @@ static int rtw_check_join_candidate(struct mlme_priv *pmlmepriv
}

/* check ssid, if needed */
- if (pmlmepriv->assoc_ssid.Ssid && pmlmepriv->assoc_ssid.SsidLength) {
+ if (pmlmepriv->assoc_ssid.SsidLength) {
if (competitor->network.Ssid.SsidLength != pmlmepriv->assoc_ssid.SsidLength ||
memcmp(competitor->network.Ssid.Ssid, pmlmepriv->assoc_ssid.Ssid, pmlmepriv->assoc_ssid.SsidLength))
goto exit;
--
2.33.0.rc0