[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20210818085809.31451-1-straube.linux@gmail.com>
Date: Wed, 18 Aug 2021 10:58:09 +0200
From: Michael Straube <straube.linux@...il.com>
To: gregkh@...uxfoundation.org
Cc: Larry.Finger@...inger.net, phil@...lpotter.co.uk, martin@...ser.cx,
fmdefrancesco@...il.com, linux-staging@...ts.linux.dev,
linux-kernel@...r.kernel.org,
Michael Straube <straube.linux@...il.com>
Subject: [PATCH] staging: r8188eu: remove null pointer checks before kfree
kfree(NULL) is safe, so remove unnecessary null pointer checks before
calls to kfree. Reported by checkpatch.
Signed-off-by: Michael Straube <straube.linux@...il.com>
---
drivers/staging/r8188eu/core/rtw_ap.c | 3 +--
drivers/staging/r8188eu/core/rtw_cmd.c | 13 +++----------
2 files changed, 4 insertions(+), 12 deletions(-)
diff --git a/drivers/staging/r8188eu/core/rtw_ap.c b/drivers/staging/r8188eu/core/rtw_ap.c
index 8ef0586b753f..1127e9a52458 100644
--- a/drivers/staging/r8188eu/core/rtw_ap.c
+++ b/drivers/staging/r8188eu/core/rtw_ap.c
@@ -1314,8 +1314,7 @@ static void update_bcn_wps_ie(struct adapter *padapter)
pnetwork->IELength = wps_offset + (wps_ielen + 2) + remainder_ielen;
}
- if (pbackup_remainder_ie)
- kfree(pbackup_remainder_ie);
+ kfree(pbackup_remainder_ie);
}
static void update_bcn_p2p_ie(struct adapter *padapter)
diff --git a/drivers/staging/r8188eu/core/rtw_cmd.c b/drivers/staging/r8188eu/core/rtw_cmd.c
index a68776f5e67b..955499eb608a 100644
--- a/drivers/staging/r8188eu/core/rtw_cmd.c
+++ b/drivers/staging/r8188eu/core/rtw_cmd.c
@@ -89,13 +89,9 @@ void rtw_free_evt_priv(struct evt_priv *pevtpriv)
void _rtw_free_cmd_priv(struct cmd_priv *pcmdpriv)
{
-
if (pcmdpriv) {
- if (pcmdpriv->cmd_allocated_buf)
- kfree(pcmdpriv->cmd_allocated_buf);
-
- if (pcmdpriv->rsp_allocated_buf)
- kfree(pcmdpriv->rsp_allocated_buf);
+ kfree(pcmdpriv->cmd_allocated_buf);
+ kfree(pcmdpriv->rsp_allocated_buf);
}
}
@@ -818,11 +814,8 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork)
psecnetwork = (struct wlan_bssid_ex *)&psecuritypriv->sec_bss;
if (!psecnetwork) {
- if (pcmd)
- kfree(pcmd);
-
+ kfree(pcmd);
res = _FAIL;
-
goto exit;
}
--
2.32.0
Powered by blists - more mailing lists