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 4/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_recv.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/rtl8188eu/core/rtw_recv.c +1 -2
index 40b7a30..e5a6427 100644
@@ -116,8 +116,7 @@ void _rtw_free_recv_priv(struct recv_priv *precvpriv)
 
 	rtw_free_uc_swdec_pending_queue(padapter);
 
-	if (precvpriv->pallocated_frame_buf)
-		vfree(precvpriv->pallocated_frame_buf);
+	vfree(precvpriv->pallocated_frame_buf);
 
 	rtw_hal_free_recv_priv(padapter);
 

--
2.1.4