From: Simran Singhal Date: Thu, 26 Mar 2020 13:28:23 +0000 (+0530) Subject: staging: rtl8723bs: hal: Remove NULL check before kfree X-Git-Tag: v5.10.7~2990^2~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b67b7b0465ff9cf89c11dd383d2888b29531f096;p=platform%2Fkernel%2Flinux-rpi.git 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 Link: https://lore.kernel.org/r/20200326132823.GA18625@simran-Inspiron-5558 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c b/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c index 2b375e7..c3051eb 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; }