Skip to contentSkip to conversation

staging: rtl8188eu: os_dep: Remove NULL test before vfree

PATCH In review Bhaktipriya Shridhar 1 participant 1 message Feb 28, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH v3 3/4 staging: rtl8188eu: os_dep: 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/os_dep/usb_intf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8188eu/os_dep/usb_intf.c +1 -1
index 6a68f17..e8d2236 100644
@@ -442,7 +442,7 @@ free_adapter:
 	if (status != _SUCCESS) {
 		if (pnetdev)
 			rtw_free_netdev(pnetdev);
-		else if (padapter)
+		else
 			vfree(padapter);
 		padapter = NULL;
 	}

--
2.1.4