mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Staging: rtl8723bs: Do not check for NOT NULL before kfree()
@ 2017-12-19 19:07 Shreeya Patel
  0 siblings, 0 replies; only message in thread
From: Shreeya Patel @ 2017-12-19 19:07 UTC (permalink / raw)
  To: gregkh, devel, linux-kernel; +Cc: Shreeya Patel

Do not check for NOT NULL before calling kfree because
if the pointer is NULL, no action occurs.
Done using the following semantic patch by coccinelle.

@@
expression ptr;
@@

- if (ptr != NULL)
  kfree(ptr);

Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_cmd.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index 9ac2dea..af0a9e0 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -846,9 +846,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;
 
 		RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("rtw_joinbss_cmd :psecnetwork == NULL!!!\n"));
-- 
2.7.4

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-12-19 19:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-19 19:07 [PATCH] Staging: rtl8723bs: Do not check for NOT NULL before kfree() Shreeya Patel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®