Skip to contentSkip to conversation

staging: rtl8188eu: core: Remove NULL Test before vfree

PATCH Superseded Bhaktipriya Shridhar 1 participant 1 message Feb 28, 2016 Staging

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 5/6 staging: rtl8188eu: core: Remove NULL Test before vfree

vfree frees the virtually continuous memory area starting at addr. If addr is NULL, no operation is performed. So NULL test is not needed before vfree.

This was done using Coccinelle:

@@
expression x;
@@
-if (x != NULL)

    vfree(x);

@@
expression x;
@@

-if (x != NULL) {
    vfree(x);
    x = NULL;

-}

---
 drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/rtl8188eu/core/rtw_sta_mgt.c +1 -2
index ce655b6..c1abd5e 100644
@@ -172,8 +172,7 @@ u32	_rtw_free_sta_priv(struct	sta_priv *pstapriv)
 		spin_unlock_bh(&pstapriv->sta_hash_lock);
 		/*===============================*/
 
-		if (pstapriv->pallocated_stainfo_buf)
-			vfree(pstapriv->pallocated_stainfo_buf);
+		vfree(pstapriv->pallocated_stainfo_buf);
 	}
 
 	return _SUCCESS;

--
2.1.4