Skip to content

Commit

Permalink
staging: rtl8188eu: core: Remove null check before kfree
Browse files Browse the repository at this point in the history
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.

// <smpl>
@@ expression E; @@
- if (E != NULL) { kfree(E); }
+ kfree(E);
@@ expression E; @@
- if (E != NULL) { kfree(E); E = NULL; }
+ kfree(E);
+ E = NULL;
// </smpl>smpl>

Build tested it.

Signed-off-by: Tapasweni Pathak <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
tapaswenipathak authored and gregkh committed Oct 30, 2014
1 parent 7ede7af commit a055b3c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/staging/rtl8188eu/core/rtw_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit a055b3c

Please sign in to comment.