staging: rtl8723bs: cleanup NULL check before vfree
authorAmarjargal Gundjalam <amarjargal16@gmail.com>
Mon, 26 Oct 2020 14:15:10 +0000 (22:15 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 27 Oct 2020 11:23:10 +0000 (12:23 +0100)
Remove redundant NULL pointer check before vfree() since vfree() does
its own NULL check. Reported by coccinelle.

Signed-off-by: Amarjargal Gundjalam <amarjargal16@gmail.com>
Link: https://lore.kernel.org/r/20201026141510.GA21791@AJ-T14
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8723bs/core/rtw_mlme.c
drivers/staging/rtl8723bs/core/rtw_recv.c
drivers/staging/rtl8723bs/core/rtw_sta_mgt.c
drivers/staging/rtl8723bs/core/rtw_xmit.c

index 9531ba5..263f132 100644 (file)
@@ -112,8 +112,7 @@ void _rtw_free_mlme_priv(struct mlme_priv *pmlmepriv)
 {
        if (pmlmepriv) {
                rtw_free_mlme_priv_ie_data(pmlmepriv);
-               if (pmlmepriv->free_bss_buf)
-                       vfree(pmlmepriv->free_bss_buf);
+               vfree(pmlmepriv->free_bss_buf);
        }
 }
 
index 6979f8d..560c188 100644 (file)
@@ -95,8 +95,7 @@ void _rtw_free_recv_priv(struct recv_priv *precvpriv)
 
        rtw_os_recv_resource_free(precvpriv);
 
-       if (precvpriv->pallocated_frame_buf)
-               vfree(precvpriv->pallocated_frame_buf);
+       vfree(precvpriv->pallocated_frame_buf);
 
        rtw_hal_free_recv_priv(padapter);
 }
index e3f56c6..dad982e 100644 (file)
@@ -177,8 +177,7 @@ u32 _rtw_free_sta_priv(struct       sta_priv *pstapriv)
 
                kfree_sta_priv_lock(pstapriv);
 
-               if (pstapriv->pallocated_stainfo_buf)
-                       vfree(pstapriv->pallocated_stainfo_buf);
+               vfree(pstapriv->pallocated_stainfo_buf);
 
        }
        return _SUCCESS;
index 6ecaff9..10a34bc 100644 (file)
@@ -290,11 +290,8 @@ void _rtw_free_xmit_priv(struct xmit_priv *pxmitpriv)
                pxmitbuf++;
        }
 
-       if (pxmitpriv->pallocated_frame_buf)
-               vfree(pxmitpriv->pallocated_frame_buf);
-
-       if (pxmitpriv->pallocated_xmitbuf)
-               vfree(pxmitpriv->pallocated_xmitbuf);
+       vfree(pxmitpriv->pallocated_frame_buf);
+       vfree(pxmitpriv->pallocated_xmitbuf);
 
        /* free xframe_ext queue,  the same count as extbuf  */
        pxmitframe = (struct xmit_frame *)pxmitpriv->xframe_ext;
@@ -304,8 +301,8 @@ void _rtw_free_xmit_priv(struct xmit_priv *pxmitpriv)
                        pxmitframe++;
                }
        }
-       if (pxmitpriv->xframe_ext_alloc_addr)
-               vfree(pxmitpriv->xframe_ext_alloc_addr);
+
+       vfree(pxmitpriv->xframe_ext_alloc_addr);
 
        /*  free xmit extension buff */
        pxmitbuf = (struct xmit_buf *)pxmitpriv->pxmit_extbuf;
@@ -315,8 +312,7 @@ void _rtw_free_xmit_priv(struct xmit_priv *pxmitpriv)
                pxmitbuf++;
        }
 
-       if (pxmitpriv->pallocated_xmit_extbuf)
-               vfree(pxmitpriv->pallocated_xmit_extbuf);
+       vfree(pxmitpriv->pallocated_xmit_extbuf);
 
        for (i = 0; i < CMDBUF_MAX; i++) {
                pxmitbuf = &pxmitpriv->pcmd_xmitbuf[i];