Skip to contentSkip to conversation

staging: rtl8723bs: remove assignment in conditions

PATCH New Fabio Aiuto 1 participant 4 messages Mar 24, 2021 Staging

lore
Share & tools
lore
#0 lore raw

cover staging: rtl8723bs: remove assignment in conditions

remove all assignment in conditions in rtl8723bs,
warned by checkpatch.pl

Fabio Aiuto (3):
staging: rtl8723bs: remove assignment in condition in

    core/rtw_ieee80211.c
  staging: rtl8723bs: remove assignment in condition in
    os_dep/ioctl_cfg80211.c

staging: rtl8723bs: remove assignment in condition in
os_dep/ioctl_linux.c

 drivers/staging/rtl8723bs/core/rtw_ieee80211.c    |  5 +++--
 drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 13 ++++++++-----
 drivers/staging/rtl8723bs/os_dep/ioctl_linux.c    |  9 ++++++---
 3 files changed, 17 insertions(+), 10 deletions(-)
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/3 staging: rtl8723bs: remove assignment in condition in core/rtw_ieee80211.c

fix the following checkpatch warning:

ERROR: do not use assignment in if condition
1118: FILE: drivers/staging/rtl8723bs/core/rtw_ieee80211.c:1118:
+ if ((addr = of_get_property(np, "local-mac-address", &len)) &&

---
 drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/staging/rtl8723bs/core/rtw_ieee80211.c +3 -2
index cccbea555a32..e931afc3ba22 100644
@@ -1115,8 +1115,9 @@ void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
 	}
 
 	if (is_broadcast_ether_addr(mac) || is_zero_ether_addr(mac)) {
-		if ((addr = of_get_property(np, "local-mac-address", &len)) &&
-		    len == ETH_ALEN) {
+		addr = of_get_property(np, "local-mac-address", &len);
+
+		if (addr && len == ETH_ALEN) {
 			ether_addr_copy(mac_addr, addr);
 		} else {
 			eth_random_addr(mac_addr);
Signature · 1 line
2.20.1
#2 lore raw

PATCH 2/3 staging: rtl8723bs: remove assignment in condition in os_dep/ioctl_cfg80211.c

In reply to Fabio Aiuto

fix the following checkpatch warning:

ERROR: do not use assignment in if condition
1440: FILE: drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:1440:
+ if ((wps_ie = rtw_get_wps_ie(buf, len, NULL, &wps_ielen)))
--
ERROR: do not use assignment in if condition
2465: FILE: drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:2465:
+ if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
--
ERROR: do not use assignment in if condition
2937: FILE: drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:2937:
+ if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) {
--
ERROR: do not use assignment in if condition
3335: FILE: drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:3335:
+ if (!(ndev = wdev_to_ndev(wdev)))

---
 drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +8 -5
index 03a784558d79..8deaf98a83dd 100644
@@ -1437,7 +1437,8 @@ static int rtw_cfg80211_set_probe_req_wpsp2pie(struct adapter *padapter, char *b
 
 	if (len > 0)
 	{
-		if ((wps_ie = rtw_get_wps_ie(buf, len, NULL, &wps_ielen)))
+		wps_ie = rtw_get_wps_ie(buf, len, NULL, &wps_ielen);
+		if (wps_ie)
 		{
 			#ifdef DEBUG_CFG80211
 			DBG_8192C("probe_req_wps_ielen =%d\n", wps_ielen);
@@ -2462,7 +2463,8 @@ static netdev_tx_t rtw_cfg80211_monitor_if_xmit_entry(struct sk_buff *skb, struc
 			DBG_871X("RTW_Tx:category(%u), action(%u)\n", category, action);
 
 		/* starting alloc mgmt frame to dump it */
-		if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
+		pmgntframe = alloc_mgtxmitframe(pxmitpriv);
+		if (!pmgntframe)
 			goto fail;
 
 		/* update attribute */
@@ -2934,7 +2936,8 @@ static int _cfg80211_rtw_mgmt_tx(struct adapter *padapter, u8 tx_ch, const u8 *b
 	}
 
 	/* starting alloc mgmt frame to dump it */
-	if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) {
+	pmgntframe = alloc_mgtxmitframe(pxmitpriv);
+	if (!pmgntframe) {
 		/* ret = -ENOMEM; */
 		ret = _FAIL;
 		goto exit;
@@ -3331,8 +3334,8 @@ void rtw_wdev_unregister(struct wireless_dev *wdev)
 
 	if (!wdev)
 		return;
-
-	if (!(ndev = wdev_to_ndev(wdev)))
+	ndev = wdev_to_ndev(wdev);
+	if (!ndev)
 		return;
 
 	adapter = rtw_netdev_priv(ndev);
Signature · 1 line
2.20.1
#3 lore raw

PATCH 3/3 staging: rtl8723bs: remove assignment in condition in os_dep/ioctl_linux.c

In reply to Fabio Aiuto

fix the following checkpatch warning:

ERROR: do not use assignment in if condition
2607: FILE: drivers/staging/rtl8723bs/os_dep/ioctl_linux.c:2607:
+ if (0 != (ret = rtw_change_ifname(padapter, new_ifname)))
--
ERROR: do not use assignment in if condition
4239: FILE: drivers/staging/rtl8723bs/os_dep/ioctl_linux.c:4239:
+ if (!(ext = vmalloc(len)))
--
ERROR: do not use assignment in if condition
4253: FILE: drivers/staging/rtl8723bs/os_dep/ioctl_linux.c:4253:
+ if (!(ext_dbg = vmalloc(len))) {

---
 drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +6 -3
index 9909dece0b01..eac98e455413 100644
@@ -2604,7 +2604,8 @@ static int rtw_rereg_nd_name(struct net_device *dev,
 		return ret;
 
 	DBG_871X("%s new_ifname:%s\n", __func__, new_ifname);
-	if (0 != (ret = rtw_change_ifname(padapter, new_ifname)))
+	ret = rtw_change_ifname(padapter, new_ifname);
+	if (ret != 0)
 		goto exit;
 
 	strncpy(rereg_priv->old_ifname, new_ifname, IFNAMSIZ);
@@ -4236,7 +4237,8 @@ static int rtw_wx_set_priv(struct net_device *dev,
 		return -EFAULT;
 
 	len = dwrq->length;
-	if (!(ext = vmalloc(len)))
+	ext = vmalloc(len);
+	if (!ext)
 		return -ENOMEM;
 
 	if (copy_from_user(ext, dwrq->pointer, len)) {
@@ -4250,7 +4252,8 @@ static int rtw_wx_set_priv(struct net_device *dev,
 	/* 	  dev->name, ext)); */
 
 	#ifdef DEBUG_RTW_WX_SET_PRIV
-	if (!(ext_dbg = vmalloc(len))) {
+	ext_dbg = vmalloc(len);
+	if (!ext_dbg) {
 		vfree(ext, len);
 		return -ENOMEM;
 	}
Signature · 1 line
2.20.1