From 90855921ac92834daa809a5ce97a72de464260a7 Mon Sep 17 00:00:00 2001 From: Amarjargal Gundjalam Date: Mon, 26 Oct 2020 22:15:10 +0800 Subject: [PATCH] staging: rtl8723bs: cleanup NULL check before vfree Remove redundant NULL pointer check before vfree() since vfree() does its own NULL check. Reported by coccinelle. Signed-off-by: Amarjargal Gundjalam Link: https://lore.kernel.org/r/20201026141510.GA21791@AJ-T14 Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/core/rtw_mlme.c | 3 +-- drivers/staging/rtl8723bs/core/rtw_recv.c | 3 +-- drivers/staging/rtl8723bs/core/rtw_sta_mgt.c | 3 +-- drivers/staging/rtl8723bs/core/rtw_xmit.c | 14 +++++--------- 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c index 9531ba54e95b..263f132cafdc 100644 --- a/drivers/staging/rtl8723bs/core/rtw_mlme.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c @@ -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); } } diff --git a/drivers/staging/rtl8723bs/core/rtw_recv.c b/drivers/staging/rtl8723bs/core/rtw_recv.c index 6979f8dbccb8..560c188f0309 100644 --- a/drivers/staging/rtl8723bs/core/rtw_recv.c +++ b/drivers/staging/rtl8723bs/core/rtw_recv.c @@ -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); } diff --git a/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c b/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c index e3f56c6cc882..dad982ed4ecf 100644 --- a/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c +++ b/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c @@ -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; diff --git a/drivers/staging/rtl8723bs/core/rtw_xmit.c b/drivers/staging/rtl8723bs/core/rtw_xmit.c index 6ecaff9728fd..10a34bce1f67 100644 --- a/drivers/staging/rtl8723bs/core/rtw_xmit.c +++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c @@ -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];