From a055b3cbb72d2487938d3452c79e2a338088fbc1 Mon Sep 17 00:00:00 2001 From: Tapasweni Pathak Date: Thu, 30 Oct 2014 21:08:09 +0530 Subject: [PATCH] staging: rtl8188eu: core: Remove null check before kfree kfree on NULL pointer is a no-op. This patch uses the following semantic patch to find such an instance where NULL check is present before kfree. // @@ expression E; @@ - if (E != NULL) { kfree(E); } + kfree(E); @@ expression E; @@ - if (E != NULL) { kfree(E); E = NULL; } + kfree(E); + E = NULL; // smpl> Build tested it. Signed-off-by: Tapasweni Pathak Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_cmd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c b/drivers/staging/rtl8188eu/core/rtw_cmd.c index 7731cdb72b22..dd24138d13b1 100644 --- a/drivers/staging/rtl8188eu/core/rtw_cmd.c +++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c @@ -433,8 +433,7 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) psecnetwork = (struct wlan_bssid_ex *)&psecuritypriv->sec_bss; if (psecnetwork == NULL) { - if (pcmd != NULL) - kfree(pcmd); + kfree(pcmd); res = _FAIL; -- 2.20.1