Skip to contentSkip to conversation

Staging: rtl8723bs: Do not check for NOT NULL before kfree()

PATCH New Shreeya Patel 1 participant 1 message Dec 19, 2017 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: rtl8723bs: Do not check for NOT NULL before kfree()

Do not check for NOT NULL before calling kfree because if the pointer is NULL, no action occurs. Done using the following semantic patch by coccinelle.

@@
expression ptr;
@@

- if (ptr != NULL)
kfree(ptr);

---
 drivers/staging/rtl8723bs/core/rtw_cmd.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/rtl8723bs/core/rtw_cmd.c +1 -3
index 9ac2dea..af0a9e0 100644
@@ -846,9 +846,7 @@ u8 rtw_joinbss_cmd(struct adapter  *padapter, struct wlan_network *pnetwork)
 
 	psecnetwork = (struct wlan_bssid_ex *)&psecuritypriv->sec_bss;
 	if (psecnetwork == NULL) {
-		if (pcmd != NULL)
-			kfree(pcmd);
-
+		kfree(pcmd);
 		res = _FAIL;
 
 		RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("rtw_joinbss_cmd :psecnetwork == NULL!!!\n"));
Signature · 1 line
2.7.4