2023-07-22 22:30:38

by Franziska Näpelt

[permalink] [raw]
Subject: [PATCH 0/9] staging: rtl8723bs: ioctl_linux: Fix checkpatch issues

This is a series of patches to fix some trivial checkpatch issues. Not all
issues have been fixed.

Testing:
* Build the module
* Boot the kernel with busybox in initramfs
* Load the module

Franziska Naepelt (9):
staging: rtl8723bs: ioctl_linux: Fix else on next line
staging: rtl8723bs: ioctl_linux: Fix code indent
staging: rtl8723bs: ioctl_linux: Fix block comment alignment
staging: rtl8723bs: ioctl_linux: Remove multiple blank lines
staging: rtl8723bs: ioctl_linux: Remove unnecessary blank lines
staging: rtl8723bs: ioctl_linux: Remove unnecessary parentheses
staging: rtl8723bs: ioctl_linux: Fix alignment on open parenthesis
staging: rtl8723bs: ioctl_linux: Add preferred spaces
staging: rtl8723bs: ioctl_linux: Fix comparison to false

.../staging/rtl8723bs/os_dep/ioctl_linux.c | 161 +++++++-----------
1 file changed, 58 insertions(+), 103 deletions(-)

--
2.39.2 (Apple Git-143)



2023-07-22 22:33:05

by Franziska Näpelt

[permalink] [raw]
Subject: [PATCH 3/9] staging: rtl8723bs: ioctl_linux: Fix block comment alignment

Fix the following checkpatch issue:
- WARNING: Block comments should align the * on each line

Signed-off-by: Franziska Naepelt <[email protected]>
---
drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
index 20c296d88c8d..088d29b9ea03 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
@@ -1204,9 +1204,9 @@ static int rtw_hostapd_ioctl(struct net_device *dev, struct iw_point *p)
struct adapter *padapter = rtw_netdev_priv(dev);

/*
- * this function is expect to call in master mode, which allows no power saving
- * so, we just check hw_init_completed
- */
+ * this function is expect to call in master mode, which allows no power saving
+ * so, we just check hw_init_completed
+ */

if (!padapter->hw_init_completed)
return -EPERM;
--
2.39.2 (Apple Git-143)


2023-07-22 22:40:19

by Franziska Näpelt

[permalink] [raw]
Subject: [PATCH 1/9] staging: rtl8723bs: ioctl_linux: Fix else on next line

Fix the following checkpatch issue:
- ERROR: else should follow close brace '}'

Signed-off-by: Franziska Naepelt <[email protected]>
---
drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
index 40a3157fb735..b8595b28bceb 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
@@ -654,8 +654,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param,

psecuritypriv->busetkipkey = true;

- }
- else if (strcmp(param->u.crypt.alg, "CCMP") == 0) {
+ } else if (strcmp(param->u.crypt.alg, "CCMP") == 0) {
psecuritypriv->dot118021XGrpPrivacy = _AES_;

memcpy(grpkey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len));
--
2.39.2 (Apple Git-143)


2023-07-22 22:41:14

by Franziska Näpelt

[permalink] [raw]
Subject: [PATCH 8/9] staging: rtl8723bs: ioctl_linux: Add preferred spaces

Fix the following checkpatch issues:
- CHECK: spaces preferred around that '+' (ctx:VxV)
- CHECK: spaces preferred around that '&' (ctx:VxV)
- CHECK: spaces preferred around that '|' (ctx:VxV)
- CHECK: spaces required around that ':' (ctx:VxV)

Signed-off-by: Franziska Naepelt <[email protected]>
---
.../staging/rtl8723bs/os_dep/ioctl_linux.c | 38 +++++++++----------
1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
index 88f560353df7..2896d64e13be 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
@@ -13,7 +13,7 @@
#include <linux/jiffies.h>
#include <linux/kernel.h>

-#define RTL_IOCTL_WPA_SUPPLICANT (SIOCIWFIRSTPRIV+30)
+#define RTL_IOCTL_WPA_SUPPLICANT (SIOCIWFIRSTPRIV + 30)

static int wpa_set_auth_algs(struct net_device *dev, u32 value)
{
@@ -315,18 +315,18 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ie
while (cnt < ielen) {
eid = buf[cnt];

- if ((eid == WLAN_EID_VENDOR_SPECIFIC) && (!memcmp(&buf[cnt+2], wps_oui, 4))) {
- padapter->securitypriv.wps_ie_len = ((buf[cnt+1]+2) < MAX_WPS_IE_LEN) ? (buf[cnt+1]+2):MAX_WPS_IE_LEN;
+ if ((eid == WLAN_EID_VENDOR_SPECIFIC) && (!memcmp(&buf[cnt + 2], wps_oui, 4))) {
+ padapter->securitypriv.wps_ie_len = ((buf[cnt + 1] + 2) < MAX_WPS_IE_LEN) ? (buf[cnt + 1] + 2) : MAX_WPS_IE_LEN;

memcpy(padapter->securitypriv.wps_ie, &buf[cnt], padapter->securitypriv.wps_ie_len);

set_fwstate(&padapter->mlmepriv, WIFI_UNDER_WPS);

- cnt += buf[cnt+1]+2;
+ cnt += buf[cnt + 1] + 2;

break;
} else {
- cnt += buf[cnt+1]+2; /* goto next */
+ cnt += buf[cnt + 1] + 2; /* goto next */
}
}
}
@@ -359,7 +359,7 @@ static int wpa_set_param(struct net_device *dev, u8 name, u32 value)

/* ret = ieee80211_wpa_enable(ieee, value); */

- switch ((value)&0xff) {
+ switch ((value) & 0xff) {
case 1: /* WPA */
padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeWPAPSK; /* WPA_PSK */
padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption2Enabled;
@@ -758,7 +758,7 @@ static int rtw_set_beacon(struct net_device *dev, struct ieee_param *param, int
if ((pstapriv->max_num_sta > NUM_STA) || (pstapriv->max_num_sta <= 0))
pstapriv->max_num_sta = NUM_STA;

- if (rtw_check_beacon_data(padapter, pbuf, (len-12-2)) == _SUCCESS)/* 12 = param header, 2:no packed */
+ if (rtw_check_beacon_data(padapter, pbuf, (len - 12 - 2)) == _SUCCESS)/* 12 = param header, 2:no packed */
ret = 0;
else
ret = -EINVAL;
@@ -787,7 +787,7 @@ static int rtw_add_sta(struct net_device *dev, struct ieee_param *param)
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct sta_priv *pstapriv = &padapter->stapriv;

- if (check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE)) != true)
+ if (check_fwstate(pmlmepriv, (_FW_LINKED | WIFI_AP_STATE)) != true)
return -EINVAL;

if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff &&
@@ -815,7 +815,7 @@ static int rtw_add_sta(struct net_device *dev, struct ieee_param *param)
memcpy(psta->bssrateset, param->u.add_sta.tx_supp_rates, 16);

/* check wmm cap. */
- if (WLAN_STA_WME&flags)
+ if (WLAN_STA_WME & flags)
psta->qos_option = 1;
else
psta->qos_option = 0;
@@ -824,7 +824,7 @@ static int rtw_add_sta(struct net_device *dev, struct ieee_param *param)
psta->qos_option = 0;

/* chec 802.11n ht cap. */
- if (WLAN_STA_HT&flags) {
+ if (WLAN_STA_HT & flags) {
psta->htpriv.ht_option = true;
psta->qos_option = 1;
memcpy((void *)&psta->htpriv.ht_cap, (void *)&param->u.add_sta.ht_cap, sizeof(struct ieee80211_ht_cap));
@@ -852,7 +852,7 @@ static int rtw_del_sta(struct net_device *dev, struct ieee_param *param)
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct sta_priv *pstapriv = &padapter->stapriv;

- if (check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE)) != true)
+ if (check_fwstate(pmlmepriv, (_FW_LINKED | WIFI_AP_STATE)) != true)
return -EINVAL;

if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff &&
@@ -891,7 +891,7 @@ static int rtw_ioctl_get_sta_data(struct net_device *dev, struct ieee_param *par
struct ieee_param_ex *param_ex = (struct ieee_param_ex *)param;
struct sta_data *psta_data = (struct sta_data *)param_ex->data;

- if (check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE)) != true)
+ if (check_fwstate(pmlmepriv, (_FW_LINKED | WIFI_AP_STATE)) != true)
return -EINVAL;

if (param_ex->sta_addr[0] == 0xff && param_ex->sta_addr[1] == 0xff &&
@@ -948,7 +948,7 @@ static int rtw_get_sta_wpaie(struct net_device *dev, struct ieee_param *param)
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct sta_priv *pstapriv = &padapter->stapriv;

- if (check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE)) != true)
+ if (check_fwstate(pmlmepriv, (_FW_LINKED | WIFI_AP_STATE)) != true)
return -EINVAL;

if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff &&
@@ -965,7 +965,7 @@ static int rtw_get_sta_wpaie(struct net_device *dev, struct ieee_param *param)

wpa_ie_len = psta->wpa_ie[1];

- copy_len = ((wpa_ie_len+2) > sizeof(psta->wpa_ie)) ? (sizeof(psta->wpa_ie)):(wpa_ie_len+2);
+ copy_len = ((wpa_ie_len + 2) > sizeof(psta->wpa_ie)) ? (sizeof(psta->wpa_ie)) : (wpa_ie_len + 2);

param->u.wpa_ie.len = copy_len;

@@ -990,7 +990,7 @@ static int rtw_set_wps_beacon(struct net_device *dev, struct ieee_param *param,
if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true)
return -EINVAL;

- ie_len = len-12-2;/* 12 = param header, 2:no packed */
+ ie_len = len - 12 - 2;/* 12 = param header, 2:no packed */

kfree(pmlmepriv->wps_beacon_ie);
pmlmepriv->wps_beacon_ie = NULL;
@@ -1021,7 +1021,7 @@ static int rtw_set_wps_probe_resp(struct net_device *dev, struct ieee_param *par
if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true)
return -EINVAL;

- ie_len = len-12-2;/* 12 = param header, 2:no packed */
+ ie_len = len - 12 - 2;/* 12 = param header, 2:no packed */

kfree(pmlmepriv->wps_probe_resp_ie);
pmlmepriv->wps_probe_resp_ie = NULL;
@@ -1048,7 +1048,7 @@ static int rtw_set_wps_assoc_resp(struct net_device *dev, struct ieee_param *par
if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true)
return -EINVAL;

- ie_len = len-12-2;/* 12 = param header, 2:no packed */
+ ie_len = len - 12 - 2;/* 12 = param header, 2:no packed */

kfree(pmlmepriv->wps_assoc_resp_ie);
pmlmepriv->wps_assoc_resp_ie = NULL;
@@ -1086,14 +1086,14 @@ static int rtw_set_hidden_ssid(struct net_device *dev, struct ieee_param *param,

mlmeinfo->hidden_ssid_mode = ignore_broadcast_ssid = param->u.bcn_ie.reserved[1];

- ie_len = len-12-2;/* 12 = param header, 2:no packed */
+ ie_len = len - 12 - 2;/* 12 = param header, 2:no packed */
ssid_ie = rtw_get_ie(param->u.bcn_ie.buf, WLAN_EID_SSID, &ssid_len, ie_len);

if (ssid_ie && ssid_len > 0 && ssid_len <= NDIS_802_11_LENGTH_SSID) {
struct wlan_bssid_ex *pbss_network = &mlmepriv->cur_network.network;
struct wlan_bssid_ex *pbss_network_ext = &mlmeinfo->network;

- memcpy(ssid, ssid_ie+2, ssid_len);
+ memcpy(ssid, ssid_ie + 2, ssid_len);
ssid[ssid_len] = 0x0;

memcpy(pbss_network->ssid.ssid, (void *)ssid, ssid_len);
--
2.39.2 (Apple Git-143)


2023-07-22 23:00:08

by Franziska Näpelt

[permalink] [raw]
Subject: [PATCH 5/9] staging: rtl8723bs: ioctl_linux: Remove unnecessary blank lines

Fix the following checkpatch issues:
- CHECK: Blank lines aren't necessary before a close brace '}'
- CHECK: Blank lines aren't necessary after an open brace '{'

Signed-off-by: Franziska Naepelt <[email protected]>
---
.../staging/rtl8723bs/os_dep/ioctl_linux.c | 26 -------------------
1 file changed, 26 deletions(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
index 16ff55d75687..cde2c5d1e92c 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
@@ -40,7 +40,6 @@ static int wpa_set_auth_algs(struct net_device *dev, u32 value)
}

return ret;
-
}

static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, u32 param_len)
@@ -80,7 +79,6 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param,
}

if (strcmp(param->u.crypt.alg, "WEP") == 0) {
-
padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled;
padapter->securitypriv.dot11PrivacyAlgrthm = _WEP40_;
padapter->securitypriv.dot118021XGrpPrivacy = _WEP40_;
@@ -392,7 +390,6 @@ static int wpa_set_param(struct net_device *dev, u8 name, u32 value)
* be set.
*/
break;
-
}
case IEEE_PARAM_PRIVACY_INVOKED:

@@ -429,11 +426,9 @@ static int wpa_set_param(struct net_device *dev, u8 name, u32 value)
ret = -EOPNOTSUPP;

break;
-
}

return ret;
-
}

static int wpa_mlme(struct net_device *dev, u32 command, u32 reason)
@@ -462,7 +457,6 @@ static int wpa_mlme(struct net_device *dev, u32 command, u32 reason)
}

return ret;
-
}

static int wpa_supplicant_ioctl(struct net_device *dev, struct iw_point *p)
@@ -485,7 +479,6 @@ static int wpa_supplicant_ioctl(struct net_device *dev, struct iw_point *p)
}

switch (param->cmd) {
-
case IEEE_CMD_SET_WPA_PARAM:
ret = wpa_set_param(dev, param->u.wpa_param.name, param->u.wpa_param.value);
break;
@@ -506,7 +499,6 @@ static int wpa_supplicant_ioctl(struct net_device *dev, struct iw_point *p)
default:
ret = -EOPNOTSUPP;
break;
-
}

if (ret == 0 && copy_to_user(p->pointer, param, p->length))
@@ -586,7 +578,6 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param,

pwep->key_length = wep_key_len;
pwep->length = wep_total_len;
-
}

pwep->key_index = wep_key_idx;
@@ -623,7 +614,6 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param,
}

goto exit;
-
}

if (!psta && check_fwstate(pmlmepriv, WIFI_AP_STATE)) { /* group key */
@@ -671,7 +661,6 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param,
}

goto exit;
-
}

if (psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_8021X && psta) { /* psk/802_1x */
@@ -694,7 +683,6 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param,
psecuritypriv->busetkipkey = true;

} else if (strcmp(param->u.crypt.alg, "CCMP") == 0) {
-
psta->dot118021XPrivacy = _AES_;
} else {
psta->dot118021XPrivacy = _NO_PRIVACY_;
@@ -752,7 +740,6 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param,
kfree(pwep);

return ret;
-
}

static int rtw_set_beacon(struct net_device *dev, struct ieee_param *param, int len)
@@ -777,7 +764,6 @@ static int rtw_set_beacon(struct net_device *dev, struct ieee_param *param, int
ret = -EINVAL;

return ret;
-
}

static void rtw_hostapd_sta_flush(struct net_device *dev)
@@ -856,7 +842,6 @@ static int rtw_add_sta(struct net_device *dev, struct ieee_param *param)
}

return ret;
-
}

static int rtw_del_sta(struct net_device *dev, struct ieee_param *param)
@@ -885,18 +870,15 @@ static int rtw_del_sta(struct net_device *dev, struct ieee_param *param)
list_del_init(&psta->asoc_list);
pstapriv->asoc_list_cnt--;
updated = ap_free_sta(padapter, psta, true, WLAN_REASON_DEAUTH_LEAVING);
-
}
spin_unlock_bh(&pstapriv->asoc_list_lock);

associated_clients_update(padapter, updated);

psta = NULL;
-
}

return ret;
-
}

static int rtw_ioctl_get_sta_data(struct net_device *dev, struct ieee_param *param, int len)
@@ -956,7 +938,6 @@ static int rtw_ioctl_get_sta_data(struct net_device *dev, struct ieee_param *par
}

return ret;
-
}

static int rtw_get_sta_wpaie(struct net_device *dev, struct ieee_param *param)
@@ -995,7 +976,6 @@ static int rtw_get_sta_wpaie(struct net_device *dev, struct ieee_param *param)
}

return ret;
-
}

static int rtw_set_wps_beacon(struct net_device *dev, struct ieee_param *param, int len)
@@ -1029,7 +1009,6 @@ static int rtw_set_wps_beacon(struct net_device *dev, struct ieee_param *param,
}

return ret;
-
}

static int rtw_set_wps_probe_resp(struct net_device *dev, struct ieee_param *param, int len)
@@ -1057,7 +1036,6 @@ static int rtw_set_wps_probe_resp(struct net_device *dev, struct ieee_param *par
}

return ret;
-
}

static int rtw_set_wps_assoc_resp(struct net_device *dev, struct ieee_param *param, int len)
@@ -1085,7 +1063,6 @@ static int rtw_set_wps_assoc_resp(struct net_device *dev, struct ieee_param *par
}

return ret;
-
}

static int rtw_set_hidden_ssid(struct net_device *dev, struct ieee_param *param, int len)
@@ -1144,7 +1121,6 @@ static int rtw_ioctl_acl_remove_sta(struct net_device *dev, struct ieee_param *p

rtw_acl_remove_sta(padapter, param->sta_addr);
return 0;
-
}

static int rtw_ioctl_acl_add_sta(struct net_device *dev, struct ieee_param *param, int len)
@@ -1162,7 +1138,6 @@ static int rtw_ioctl_acl_add_sta(struct net_device *dev, struct ieee_param *para
}

return rtw_acl_add_sta(padapter, param->sta_addr);
-
}

static int rtw_ioctl_set_macaddr_acl(struct net_device *dev, struct ieee_param *param, int len)
@@ -1293,7 +1268,6 @@ static int rtw_hostapd_ioctl(struct net_device *dev, struct iw_point *p)
default:
ret = -EOPNOTSUPP;
break;
-
}

if (ret == 0 && copy_to_user(p->pointer, param, p->length))
--
2.39.2 (Apple Git-143)


2023-07-22 23:03:02

by Franziska Näpelt

[permalink] [raw]
Subject: [PATCH 7/9] staging: rtl8723bs: ioctl_linux: Fix alignment on open parenthesis

Fix the following checkpatch issue:
- CHECK: Alignment should match open parenthesis

Signed-off-by: Franziska Naepelt <[email protected]>
---
drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
index e4c5e249df98..88f560353df7 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
@@ -147,7 +147,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param,
psta->ieee8021x_blocked = false;

if ((padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption2Enabled) ||
- (padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption3Enabled)) {
+ (padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption3Enabled)) {
psta->dot118021XPrivacy = padapter->securitypriv.dot11PrivacyAlgrthm;
}

@@ -200,7 +200,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param,
pbcmc_sta->ieee8021x_blocked = false;

if ((padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption2Enabled) ||
- (padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption3Enabled)) {
+ (padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption3Enabled)) {
pbcmc_sta->dot118021XPrivacy = padapter->securitypriv.dot11PrivacyAlgrthm;
}
}
@@ -334,8 +334,8 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ie

/* TKIP and AES disallow multicast packets until installing group key */
if (padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_ ||
- padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_WTMIC_ ||
- padapter->securitypriv.dot11PrivacyAlgrthm == _AES_)
+ padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_WTMIC_ ||
+ padapter->securitypriv.dot11PrivacyAlgrthm == _AES_)
/* WPS open need to enable multicast */
/* check_fwstate(&padapter->mlmepriv, WIFI_UNDER_WPS) == true) */
rtw_hal_set_hwreg(padapter, HW_VAR_OFF_RCR_AM, null_addr);
--
2.39.2 (Apple Git-143)


2023-07-22 23:03:28

by Franziska Näpelt

[permalink] [raw]
Subject: [PATCH 6/9] staging: rtl8723bs: ioctl_linux: Remove unnecessary parentheses

Fix the following checkpatch issue:
- CHECK: Unnecessary parentheses around ...

Signed-off-by: Franziska Naepelt <[email protected]>
---
.../staging/rtl8723bs/os_dep/ioctl_linux.c | 58 +++++++++----------
1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
index cde2c5d1e92c..e4c5e249df98 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
@@ -125,7 +125,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param,
goto exit;
}

- memcpy(&(psecuritypriv->dot11DefKey[wep_key_idx].skey[0]), pwep->key_material, pwep->key_length);
+ memcpy(&psecuritypriv->dot11DefKey[wep_key_idx].skey[0], pwep->key_material, pwep->key_length);
psecuritypriv->dot11DefKeylen[wep_key_idx] = pwep->key_length;
rtw_set_key(padapter, psecuritypriv, wep_key_idx, 0, true);
}
@@ -156,8 +156,8 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param,

if (strcmp(param->u.crypt.alg, "TKIP") == 0) { /* set mic key */
/* DEBUG_ERR(("\nset key length :param->u.crypt.key_len =%d\n", param->u.crypt.key_len)); */
- memcpy(psta->dot11tkiptxmickey.skey, &(param->u.crypt.key[16]), 8);
- memcpy(psta->dot11tkiprxmickey.skey, &(param->u.crypt.key[24]), 8);
+ memcpy(psta->dot11tkiptxmickey.skey, &param->u.crypt.key[16], 8);
+ memcpy(psta->dot11tkiprxmickey.skey, &param->u.crypt.key[24], 8);

padapter->securitypriv.busetkipkey = false;
/* _set_timer(&padapter->securitypriv.tkip_timer, 50); */
@@ -169,8 +169,8 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param,
memcpy(padapter->securitypriv.dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len));
/* only TKIP group key need to install this */
if (param->u.crypt.key_len > 16) {
- memcpy(padapter->securitypriv.dot118021XGrptxmickey[param->u.crypt.idx].skey, &(param->u.crypt.key[16]), 8);
- memcpy(padapter->securitypriv.dot118021XGrprxmickey[param->u.crypt.idx].skey, &(param->u.crypt.key[24]), 8);
+ memcpy(padapter->securitypriv.dot118021XGrptxmickey[param->u.crypt.idx].skey, &param->u.crypt.key[16], 8);
+ memcpy(padapter->securitypriv.dot118021XGrprxmickey[param->u.crypt.idx].skey, &param->u.crypt.key[24], 8);
}
padapter->securitypriv.binstallGrpkey = true;

@@ -518,7 +518,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param,
struct sta_info *psta = NULL, *pbcmc_sta = NULL;
struct adapter *padapter = rtw_netdev_priv(dev);
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
- struct security_priv *psecuritypriv = &(padapter->securitypriv);
+ struct security_priv *psecuritypriv = &padapter->securitypriv;
struct sta_priv *pstapriv = &padapter->stapriv;
char *txkey = padapter->securitypriv.dot118021XGrptxmickey[param->u.crypt.idx].skey;
char *rxkey = padapter->securitypriv.dot118021XGrprxmickey[param->u.crypt.idx].skey;
@@ -597,7 +597,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param,

psecuritypriv->dot11PrivacyKeyIndex = wep_key_idx;

- memcpy(&(psecuritypriv->dot11DefKey[wep_key_idx].skey[0]), pwep->key_material, pwep->key_length);
+ memcpy(&psecuritypriv->dot11DefKey[wep_key_idx].skey[0], pwep->key_material, pwep->key_length);

psecuritypriv->dot11DefKeylen[wep_key_idx] = pwep->key_length;

@@ -606,7 +606,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param,
/* don't update "psecuritypriv->dot11PrivacyAlgrthm" and */
/* psecuritypriv->dot11PrivacyKeyIndex =keyid", but can rtw_set_key to cam */

- memcpy(&(psecuritypriv->dot11DefKey[wep_key_idx].skey[0]), pwep->key_material, pwep->key_length);
+ memcpy(&psecuritypriv->dot11DefKey[wep_key_idx].skey[0], pwep->key_material, pwep->key_length);

psecuritypriv->dot11DefKeylen[wep_key_idx] = pwep->key_length;

@@ -632,8 +632,8 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param,

/* DEBUG_ERR("set key length :param->u.crypt.key_len =%d\n", param->u.crypt.key_len); */
/* set mic key */
- memcpy(txkey, &(param->u.crypt.key[16]), 8);
- memcpy(psecuritypriv->dot118021XGrprxmickey[param->u.crypt.idx].skey, &(param->u.crypt.key[24]), 8);
+ memcpy(txkey, &param->u.crypt.key[16], 8);
+ memcpy(psecuritypriv->dot118021XGrprxmickey[param->u.crypt.idx].skey, &param->u.crypt.key[24], 8);

psecuritypriv->busetkipkey = true;

@@ -677,8 +677,8 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param,

/* DEBUG_ERR("set key length :param->u.crypt.key_len =%d\n", param->u.crypt.key_len); */
/* set mic key */
- memcpy(psta->dot11tkiptxmickey.skey, &(param->u.crypt.key[16]), 8);
- memcpy(psta->dot11tkiprxmickey.skey, &(param->u.crypt.key[24]), 8);
+ memcpy(psta->dot11tkiptxmickey.skey, &param->u.crypt.key[16], 8);
+ memcpy(psta->dot11tkiprxmickey.skey, &param->u.crypt.key[24], 8);

psecuritypriv->busetkipkey = true;

@@ -706,8 +706,8 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param,

/* DEBUG_ERR("set key length :param->u.crypt.key_len =%d\n", param->u.crypt.key_len); */
/* set mic key */
- memcpy(txkey, &(param->u.crypt.key[16]), 8);
- memcpy(rxkey, &(param->u.crypt.key[24]), 8);
+ memcpy(txkey, &param->u.crypt.key[16], 8);
+ memcpy(rxkey, &param->u.crypt.key[24], 8);

psecuritypriv->busetkipkey = true;

@@ -746,7 +746,7 @@ static int rtw_set_beacon(struct net_device *dev, struct ieee_param *param, int
{
int ret = 0;
struct adapter *padapter = rtw_netdev_priv(dev);
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct sta_priv *pstapriv = &padapter->stapriv;
unsigned char *pbuf = param->u.bcn_ie.buf;

@@ -784,7 +784,7 @@ static int rtw_add_sta(struct net_device *dev, struct ieee_param *param)
int ret = 0;
struct sta_info *psta = NULL;
struct adapter *padapter = rtw_netdev_priv(dev);
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct sta_priv *pstapriv = &padapter->stapriv;

if (check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE)) != true)
@@ -849,7 +849,7 @@ static int rtw_del_sta(struct net_device *dev, struct ieee_param *param)
int ret = 0;
struct sta_info *psta = NULL;
struct adapter *padapter = rtw_netdev_priv(dev);
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct sta_priv *pstapriv = &padapter->stapriv;

if (check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE)) != true)
@@ -886,7 +886,7 @@ static int rtw_ioctl_get_sta_data(struct net_device *dev, struct ieee_param *par
int ret = 0;
struct sta_info *psta = NULL;
struct adapter *padapter = rtw_netdev_priv(dev);
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct sta_priv *pstapriv = &padapter->stapriv;
struct ieee_param_ex *param_ex = (struct ieee_param_ex *)param;
struct sta_data *psta_data = (struct sta_data *)param_ex->data;
@@ -945,7 +945,7 @@ static int rtw_get_sta_wpaie(struct net_device *dev, struct ieee_param *param)
int ret = 0;
struct sta_info *psta = NULL;
struct adapter *padapter = rtw_netdev_priv(dev);
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct sta_priv *pstapriv = &padapter->stapriv;

if (check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE)) != true)
@@ -983,8 +983,8 @@ static int rtw_set_wps_beacon(struct net_device *dev, struct ieee_param *param,
int ret = 0;
unsigned char wps_oui[4] = {0x0, 0x50, 0xf2, 0x04};
struct adapter *padapter = rtw_netdev_priv(dev);
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
- struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
int ie_len;

if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true)
@@ -1015,7 +1015,7 @@ static int rtw_set_wps_probe_resp(struct net_device *dev, struct ieee_param *par
{
int ret = 0;
struct adapter *padapter = rtw_netdev_priv(dev);
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
int ie_len;

if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true)
@@ -1042,7 +1042,7 @@ static int rtw_set_wps_assoc_resp(struct net_device *dev, struct ieee_param *par
{
int ret = 0;
struct adapter *padapter = rtw_netdev_priv(dev);
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
int ie_len;

if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true)
@@ -1069,9 +1069,9 @@ static int rtw_set_hidden_ssid(struct net_device *dev, struct ieee_param *param,
{
int ret = 0;
struct adapter *adapter = rtw_netdev_priv(dev);
- struct mlme_priv *mlmepriv = &(adapter->mlmepriv);
- struct mlme_ext_priv *mlmeext = &(adapter->mlmeextpriv);
- struct mlme_ext_info *mlmeinfo = &(mlmeext->mlmext_info);
+ struct mlme_priv *mlmepriv = &adapter->mlmepriv;
+ struct mlme_ext_priv *mlmeext = &adapter->mlmeextpriv;
+ struct mlme_ext_info *mlmeinfo = &mlmeext->mlmext_info;
int ie_len;
u8 *ssid_ie;
char ssid[NDIS_802_11_LENGTH_SSID + 1];
@@ -1108,7 +1108,7 @@ static int rtw_set_hidden_ssid(struct net_device *dev, struct ieee_param *param,
static int rtw_ioctl_acl_remove_sta(struct net_device *dev, struct ieee_param *param, int len)
{
struct adapter *padapter = rtw_netdev_priv(dev);
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;

if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true)
return -EINVAL;
@@ -1126,7 +1126,7 @@ static int rtw_ioctl_acl_remove_sta(struct net_device *dev, struct ieee_param *p
static int rtw_ioctl_acl_add_sta(struct net_device *dev, struct ieee_param *param, int len)
{
struct adapter *padapter = rtw_netdev_priv(dev);
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;

if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true)
return -EINVAL;
@@ -1144,7 +1144,7 @@ static int rtw_ioctl_set_macaddr_acl(struct net_device *dev, struct ieee_param *
{
int ret = 0;
struct adapter *padapter = rtw_netdev_priv(dev);
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;

if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true)
return -EINVAL;
--
2.39.2 (Apple Git-143)


2023-07-22 23:04:33

by Franziska Näpelt

[permalink] [raw]
Subject: [PATCH 4/9] staging: rtl8723bs: ioctl_linux: Remove multiple blank lines

Fix the following checkpatch issue:
- CHECK: Please don't use multiple blank lines

Signed-off-by: Franziska Naepelt <[email protected]>
---
drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 18 ------------------
1 file changed, 18 deletions(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
index 088d29b9ea03..16ff55d75687 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
@@ -426,11 +426,8 @@ static int wpa_set_param(struct net_device *dev, u8 name, u32 value)

default:

-
-
ret = -EOPNOTSUPP;

-
break;

}
@@ -570,7 +567,6 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param,
goto exit;
}

-
if (strcmp(param->u.crypt.alg, "WEP") == 0 && !psta) {
wep_key_idx = param->u.crypt.idx;
wep_key_len = param->u.crypt.key_len;
@@ -580,7 +576,6 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param,
goto exit;
}

-
if (wep_key_len > 0) {
wep_key_len = wep_key_len <= 5 ? 5 : 13;
wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, key_material);
@@ -609,7 +604,6 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param,
psecuritypriv->dot118021XGrpPrivacy = _WEP104_;
}

-
psecuritypriv->dot11PrivacyKeyIndex = wep_key_idx;

memcpy(&(psecuritypriv->dot11DefKey[wep_key_idx].skey[0]), pwep->key_material, pwep->key_length);
@@ -632,7 +626,6 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param,

}

-
if (!psta && check_fwstate(pmlmepriv, WIFI_AP_STATE)) { /* group key */
if (param->u.crypt.set_tx == 1) {
if (strcmp(param->u.crypt.alg, "WEP") == 0) {
@@ -778,13 +771,11 @@ static int rtw_set_beacon(struct net_device *dev, struct ieee_param *param, int
if ((pstapriv->max_num_sta > NUM_STA) || (pstapriv->max_num_sta <= 0))
pstapriv->max_num_sta = NUM_STA;

-
if (rtw_check_beacon_data(padapter, pbuf, (len-12-2)) == _SUCCESS)/* 12 = param header, 2:no packed */
ret = 0;
else
ret = -EINVAL;

-
return ret;

}
@@ -837,7 +828,6 @@ static int rtw_add_sta(struct net_device *dev, struct ieee_param *param)

memcpy(psta->bssrateset, param->u.add_sta.tx_supp_rates, 16);

-
/* check wmm cap. */
if (WLAN_STA_WME&flags)
psta->qos_option = 1;
@@ -861,7 +851,6 @@ static int rtw_add_sta(struct net_device *dev, struct ieee_param *param)

update_sta_info_apmode(padapter, psta);

-
} else {
ret = -ENOMEM;
}
@@ -962,7 +951,6 @@ static int rtw_ioctl_get_sta_data(struct net_device *dev, struct ieee_param *par
psta_data->tx_bytes = psta->sta_stats.tx_bytes;
psta_data->tx_drops = psta->sta_stats.tx_drops;

-
} else {
ret = -1;
}
@@ -1024,7 +1012,6 @@ static int rtw_set_wps_beacon(struct net_device *dev, struct ieee_param *param,

ie_len = len-12-2;/* 12 = param header, 2:no packed */

-
kfree(pmlmepriv->wps_beacon_ie);
pmlmepriv->wps_beacon_ie = NULL;

@@ -1041,7 +1028,6 @@ static int rtw_set_wps_beacon(struct net_device *dev, struct ieee_param *param,
pmlmeext->bstart_bss = true;
}

-
return ret;

}
@@ -1058,7 +1044,6 @@ static int rtw_set_wps_probe_resp(struct net_device *dev, struct ieee_param *par

ie_len = len-12-2;/* 12 = param header, 2:no packed */

-
kfree(pmlmepriv->wps_probe_resp_ie);
pmlmepriv->wps_probe_resp_ie = NULL;

@@ -1071,7 +1056,6 @@ static int rtw_set_wps_probe_resp(struct net_device *dev, struct ieee_param *par
memcpy(pmlmepriv->wps_probe_resp_ie, param->u.bcn_ie.buf, ie_len);
}

-
return ret;

}
@@ -1088,7 +1072,6 @@ static int rtw_set_wps_assoc_resp(struct net_device *dev, struct ieee_param *par

ie_len = len-12-2;/* 12 = param header, 2:no packed */

-
kfree(pmlmepriv->wps_assoc_resp_ie);
pmlmepriv->wps_assoc_resp_ie = NULL;

@@ -1101,7 +1084,6 @@ static int rtw_set_wps_assoc_resp(struct net_device *dev, struct ieee_param *par
memcpy(pmlmepriv->wps_assoc_resp_ie, param->u.bcn_ie.buf, ie_len);
}

-
return ret;

}
--
2.39.2 (Apple Git-143)


2023-07-22 23:05:50

by Franziska Näpelt

[permalink] [raw]
Subject: [PATCH 9/9] staging: rtl8723bs: ioctl_linux: Fix comparison to false

Fix the following checkpatch issue:
- CHECK: Using comparison to false is error prone

Signed-off-by: Franziska Naepelt <[email protected]>
---
drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
index 2896d64e13be..54a2998e837d 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
@@ -832,7 +832,7 @@ static int rtw_add_sta(struct net_device *dev, struct ieee_param *param)
psta->htpriv.ht_option = false;
}

- if (pmlmepriv->htpriv.ht_option == false)
+ if (!pmlmepriv->htpriv.ht_option)
psta->htpriv.ht_option = false;

update_sta_info_apmode(padapter, psta);
--
2.39.2 (Apple Git-143)