diff options
author | Simran Singhal <singhalsimran0@gmail.com> | 2020-03-26 18:58:23 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-03-26 15:47:26 +0100 |
commit | b67b7b0465ff9cf89c11dd383d2888b29531f096 (patch) | |
tree | c449136411bd2e4a503d1fbe86324c174c8d9e5f /drivers/staging | |
parent | 1879d30ede2f778a8d9f147a32fc5c9f5bb90b44 (diff) |
staging: rtl8723bs: hal: Remove NULL check before kfree
NULL check before kfree is unnecessary so remove it.
The following Coccinelle script was used to detect this:
@@ expression E; @@
- if (E != NULL) { kfree(E); }
+ kfree(E);
@@ expression E; @@
- if (E != NULL) { kfree(E); E = NULL; }
+ kfree(E);
+ E = NULL;
Signed-off-by: Simran Singhal <singhalsimran0@gmail.com>
Link: https://lore.kernel.org/r/20200326132823.GA18625@simran-Inspiron-5558
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c b/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c index 2b375e75be50..c3051ebaeb78 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c @@ -480,10 +480,8 @@ initbuferror: precvpriv->precv_buf = NULL; } - if (precvpriv->pallocated_recv_buf) { - kfree(precvpriv->pallocated_recv_buf); - precvpriv->pallocated_recv_buf = NULL; - } + kfree(precvpriv->pallocated_recv_buf); + precvpriv->pallocated_recv_buf = NULL; exit: return res; @@ -518,8 +516,6 @@ void rtl8723bs_free_recv_priv(struct adapter *padapter) precvpriv->precv_buf = NULL; } - if (precvpriv->pallocated_recv_buf) { - kfree(precvpriv->pallocated_recv_buf); - precvpriv->pallocated_recv_buf = NULL; - } + kfree(precvpriv->pallocated_recv_buf); + precvpriv->pallocated_recv_buf = NULL; } |