]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: rtl8188eu: core: Remove NULL test before vfree
authorBhaktipriya Shridhar <bhaktipriya96@gmail.com>
Sun, 28 Feb 2016 20:29:20 +0000 (01:59 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 12 Mar 2016 06:09:09 +0000 (22:09 -0800)
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;
-}

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8188eu/core/rtw_recv.c
drivers/staging/rtl8188eu/core/rtw_sta_mgt.c

index d3c9ded5f0239bb443593982c037898acff75266..5f53aa1cfd8a015a6a84d4a698a0b6e7fdcb98ed 100644 (file)
@@ -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);
 
index d002f4a32cd6d7a6253dae7f0b7806b3973ffc8f..78a9b9bf3b3267876374b3ae127f87af6ce33673 100644 (file)
@@ -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;