[PATCH] staging: rtl8723bs: core: drop unneeded null tests

Julia Lawall julia.lawall at lip6.fr
Sat Apr 8 17:10:05 UTC 2017


kfree returns immediately on NULL so the tests are not needed.

Generated by: scripts/coccinelle/free/ifnullfree.cocci

CC: Hans de Goede <hdegoede at redhat.com>
Signed-off-by: Julia Lawall <julia.lawall at lip6.fr>
Signed-off-by: Fengguang Wu <fengguang.wu at intel.com>
---

 rtw_cmd.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -248,11 +248,9 @@ void _rtw_free_evt_priv(struct	evt_priv
 void _rtw_free_cmd_priv(struct	cmd_priv *pcmdpriv)
 {
 	if (pcmdpriv) {
-		if (pcmdpriv->cmd_allocated_buf)
-			kfree(pcmdpriv->cmd_allocated_buf);
+		kfree(pcmdpriv->cmd_allocated_buf);

-		if (pcmdpriv->rsp_allocated_buf)
-			kfree(pcmdpriv->rsp_allocated_buf);
+		kfree(pcmdpriv->rsp_allocated_buf);

 		mutex_destroy(&pcmdpriv->sctx_mutex);
 	}


More information about the devel mailing list