Skip to contentSkip to conversation

Staging: rtl8188eu: core: Remove NULL test before vfree

PATCH In review Bhumika Goyal 2 participants 5 messages Feb 14, 2016 Staging

lore
Share & tools
lore
#0 lore raw

cover Staging: rtl8188eu: core: Remove NULL test before vfree

The function vfree test whether the argument is NULL and return immediately. SO NULL test is not needed before vfree.

Bhumika Goyal (2):
Staging: rtl8188eu: core: Remove NULL test before vfree
Staging: rtl8188eu: core: Remove NULL test before vfree

 drivers/staging/rtl8188eu/core/rtw_mlme.c | 3 +--
 drivers/staging/rtl8188eu/core/rtw_xmit.c | 6 ++----
 2 files changed, 3 insertions(+), 6 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/2 Staging: rtl8188eu: core: Remove NULL test before vfree

The function vfree test whether the argument is NULL and return immediately. SO NULL test is not needed before vfree.

---
 drivers/staging/rtl8188eu/core/rtw_mlme.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/rtl8188eu/core/rtw_mlme.c +1 -2
index 9c2e659..d9b9bf3 100644
@@ -123,8 +123,7 @@ void rtw_free_mlme_priv(struct mlme_priv *pmlmepriv)
 	rtw_free_mlme_priv_ie_data(pmlmepriv);
 
 	if (pmlmepriv) {
-		if (pmlmepriv->free_bss_buf)
-			vfree(pmlmepriv->free_bss_buf);
+		vfree(pmlmepriv->free_bss_buf);
 	}
 }
 
Signature · 1 line
1.9.1
#2 lore raw
Quoted 2 lines · Bhumika Goyal

The function vfree test whether the argument is NULL and return immediately. SO NULL test is not needed before vfree.

test -> tests, return -> returns, SO -> So.

Quoted 11 lines
---
 drivers/staging/rtl8188eu/core/rtw_mlme.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/rtl8188eu/core/rtw_mlme.c +0 -0
index 9c2e659..d9b9bf3 100644

drivers/staging/rtl8188eu/core/rtw_mlme.c void rtw_free_mlme_priv(struct mlme_priv *pmlmepriv) · line 127

Quoted 7 lines
drivers/staging/rtl8188eu/core/rtw_mlme.c +1 -2
@@ -123,8 +123,7 @@ void rtw_free_mlme_priv(struct mlme_priv *pmlmepriv)
 	rtw_free_mlme_priv_ie_data(pmlmepriv);
 
 	if (pmlmepriv) {
-		if (pmlmepriv->free_bss_buf)
-			vfree(pmlmepriv->free_bss_buf);
+		vfree(pmlmepriv->free_bss_buf);
 	}

Check patch should have warned about the braces around the if branch no longer being needed. They should be removed as well.

julia

Quoted 12 lines
drivers/staging/rtl8188eu/core/rtw_mlme.c +0 -0
 }
 
Signature · 8 lines
1.9.1

-- 
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/c2c521e2570272a1749cef362817e6231000530e.1455461125.git.bhumirks%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
#3 lore raw

PATCH 2/2 Staging: rtl8188eu: core: Remove NULL test before vfree

In reply to Bhumika Goyal

The function vfree test whether the argument is NULL and return immediately. SO NULL test is not needed before vfree.

---
 drivers/staging/rtl8188eu/core/rtw_xmit.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/rtl8188eu/core/rtw_xmit.c +2 -4
index d5ce1e2..2a419459 100644
@@ -247,11 +247,9 @@ void _rtw_free_xmit_priv(struct xmit_priv *pxmitpriv)
 		pxmitbuf++;
 	}
 
-	if (pxmitpriv->pallocated_frame_buf)
-		vfree(pxmitpriv->pallocated_frame_buf);
+	vfree(pxmitpriv->pallocated_frame_buf);
 
-	if (pxmitpriv->pallocated_xmitbuf)
-		vfree(pxmitpriv->pallocated_xmitbuf);
+	vfree(pxmitpriv->pallocated_xmitbuf);
 
 	/*  free xmit extension buff */
 	pxmitbuf = (struct xmit_buf *)pxmitpriv->pxmit_extbuf;
Signature · 1 line
1.9.1
#4 lore raw
Quoted 13 lines · Bhumika Goyal

The function vfree test whether the argument is NULL and return immediately. SO NULL test is not needed before vfree.

---
 drivers/staging/rtl8188eu/core/rtw_xmit.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/rtl8188eu/core/rtw_xmit.c +0 -0
index d5ce1e2..2a419459 100644

drivers/staging/rtl8188eu/core/rtw_xmit.c void _rtw_free_xmit_priv(struct xmit_priv *pxmitpriv) · line 252

Quoted 10 lines
drivers/staging/rtl8188eu/core/rtw_xmit.c +2 -4
@@ -247,11 +247,9 @@ void _rtw_free_xmit_priv(struct xmit_priv *pxmitpriv)
 		pxmitbuf++;
 	}
 
-	if (pxmitpriv->pallocated_frame_buf)
-		vfree(pxmitpriv->pallocated_frame_buf);
+	vfree(pxmitpriv->pallocated_frame_buf);
 
-	if (pxmitpriv->pallocated_xmitbuf)
-		vfree(pxmitpriv->pallocated_xmitbuf);
+	vfree(pxmitpriv->pallocated_xmitbuf);

It's a minor issue, but maybe the blank line isn't needed between the calls anymore either.

julia

Quoted 13 lines
drivers/staging/rtl8188eu/core/rtw_xmit.c +0 -0
 	/*  free xmit extension buff */
 	pxmitbuf = (struct xmit_buf *)pxmitpriv->pxmit_extbuf;
Signature · 8 lines
1.9.1

-- 
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/0268938371b2973ed55cf58c884abc5b0ce6e2bb.1455461125.git.bhumirks%40gmail.com.
For more options, visit https://groups.google.com/d/optout.