Skip to contentSkip to conversation

staging: rtl8712: remove unnecessary NULL check

PATCH In review Himadri Pandya 2 participants 3 messages Apr 3, 2019 – Apr 16, 2019 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8712: remove unnecessary NULL check

List wlan_network is built properly with init_list_head and list_add_tail which cancels out its probability of being NULL because of the precence of list_head at the top of this structure. Hence, the NULL test can be omitted.

---
 drivers/staging/rtl8712/rtl871x_mlme.c | 2 --
 1 file changed, 2 deletions(-)
drivers/staging/rtl8712/rtl871x_mlme.c +0 -2
index e370841a79ca..7c7267d0fc9e 100644
@@ -1120,8 +1120,6 @@ int r8712_select_and_join_from_scan(struct mlme_priv *pmlmepriv)
 		}
 		pnetwork = container_of(pmlmepriv->pscanned,
 					struct wlan_network, list);
-		if (!pnetwork)
-			return _FAIL;
 		pmlmepriv->pscanned = pmlmepriv->pscanned->next;
 		if (pmlmepriv->assoc_by_bssid) {
 			dst_ssid = pnetwork->network.MacAddress;
Signature · 1 line
2.17.1
#1 lore raw
Quoted 25 lines · Himadri Pandya,

List wlan_network is built properly with init_list_head and list_add_tail which cancels out its probability of being NULL because of the precence of list_head at the top of this structure. Hence, the NULL test can be omitted.

---
 drivers/staging/rtl8712/rtl871x_mlme.c | 2 --
 1 file changed, 2 deletions(-)
drivers/staging/rtl8712/rtl871x_mlme.c +0 -2
index e370841a79ca..7c7267d0fc9e 100644
@@ -1120,8 +1120,6 @@ int r8712_select_and_join_from_scan(struct mlme_priv
 *pmlmepriv)
                }
                pnetwork = container_of(pmlmepriv->pscanned,
                                        struct wlan_network, list);
-               if (!pnetwork)
-                       return _FAIL;
                pmlmepriv->pscanned = pmlmepriv->pscanned->next;
                if (pmlmepriv->assoc_by_bssid) {
                        dst_ssid = pnetwork->network.MacAddress;
Quoted 3 lines

--
2.17.1

Please let me know if the patch needs any further improvements.

Thank you.

- Himadri

Quoted 1 line
maintainer
#2 lore raw
Quoted 24 lines · Himadri Pandya
Quoted 22 lines · Himadri Pandya,

List wlan_network is built properly with init_list_head and list_add_tail which cancels out its probability of being NULL because of the precence of list_head at the top of this structure. Hence, the NULL test can be omitted.

---
 drivers/staging/rtl8712/rtl871x_mlme.c | 2 --
 1 file changed, 2 deletions(-)
drivers/staging/rtl8712/rtl871x_mlme.c +0 -2
index e370841a79ca..7c7267d0fc9e 100644
@@ -1120,8 +1120,6 @@ int r8712_select_and_join_from_scan(struct mlme_priv
 *pmlmepriv)
                }
                pnetwork = container_of(pmlmepriv->pscanned,
                                        struct wlan_network, list);
-               if (!pnetwork)
-                       return _FAIL;
Quoted 8 lines
Quoted 6 lines
drivers/staging/rtl8712/rtl871x_mlme.c +0 -0
                pmlmepriv->pscanned = pmlmepriv->pscanned->next;
                if (pmlmepriv->assoc_by_bssid) {
                        dst_ssid = pnetwork->network.MacAddress;

--
2.17.1

Please let me know if the patch needs any further improvements.

Please be patient, wait at least 2 weeks for people to get around to reviewing changes as trivial as code cleanup stuff is.

thanks,

greg k-h