LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Larry Finger <Larry.Finger@lwfinger.net>
To: gregkh@linuxfoundation.org
Cc: phil@philpotter.co.uk, linux-staging@lists.linux.dev,
	linux-kernel@vger.kernel.org,
	Larry Finger <Larry.Finger@lwfinger.net>
Subject: [PATCH 5/5] staging: r8188eu: Remove rtw_buf_free()
Date: Thu,  5 Aug 2021 13:37:17 -0500	[thread overview]
Message-ID: <20210805183717.23007-6-Larry.Finger@lwfinger.net> (raw)
In-Reply-To: <20210805183717.23007-1-Larry.Finger@lwfinger.net>

This routine is just a wrapper around kfree(). The wrapper also sets
buffer length to 0, and the pointer to NULL. The length variable is in
the struct to be freed, thus setting it to zero is meaningless. Setting
the pointer to NULL is also not needed.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
---
 drivers/staging/r8188eu/core/rtw_mlme.c         | 4 ++--
 drivers/staging/r8188eu/core/rtw_mlme_ext.c     | 9 ++++-----
 drivers/staging/r8188eu/include/osdep_service.h | 1 -
 drivers/staging/r8188eu/os_dep/osdep_service.c  | 7 -------
 4 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_mlme.c b/drivers/staging/r8188eu/core/rtw_mlme.c
index 4ffed8a35054..e3d5a721d25c 100644
--- a/drivers/staging/r8188eu/core/rtw_mlme.c
+++ b/drivers/staging/r8188eu/core/rtw_mlme.c
@@ -99,8 +99,8 @@ static void rtw_free_mlme_ie_data(u8 **ppie, u32 *plen)
 
 void rtw_free_mlme_priv_ie_data(struct mlme_priv *pmlmepriv)
 {
-	rtw_buf_free(&pmlmepriv->assoc_req, &pmlmepriv->assoc_req_len);
-	rtw_buf_free(&pmlmepriv->assoc_rsp, &pmlmepriv->assoc_rsp_len);
+	kfree(pmlmepriv->assoc_req);
+	kfree(pmlmepriv->assoc_rsp);
 	rtw_free_mlme_ie_data(&pmlmepriv->wps_beacon_ie, &pmlmepriv->wps_beacon_ie_len);
 	rtw_free_mlme_ie_data(&pmlmepriv->wps_probe_req_ie, &pmlmepriv->wps_probe_req_ie_len);
 	rtw_free_mlme_ie_data(&pmlmepriv->wps_probe_resp_ie, &pmlmepriv->wps_probe_resp_ie_len);
diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
index a8ed4e1a0278..470c338b44e1 100644
--- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
@@ -1519,11 +1519,10 @@ unsigned int OnAssocRsp(struct adapter *padapter, struct recv_frame *precv_frame
 	UpdateBrateTbl(padapter, pmlmeinfo->network.SupportedRates);
 
 report_assoc_result:
-	if (res > 0) {
+	if (res > 0)
 		rtw_buf_update(&pmlmepriv->assoc_rsp, &pmlmepriv->assoc_rsp_len, pframe, pkt_len);
-	} else {
-		rtw_buf_free(&pmlmepriv->assoc_rsp, &pmlmepriv->assoc_rsp_len);
-	}
+	else
+		kfree(pmlmepriv->assoc_rsp);
 
 	report_join_res(padapter, res);
 
@@ -5534,7 +5533,7 @@ void issue_assocreq(struct adapter *padapter)
 	if (ret == _SUCCESS)
 		rtw_buf_update(&pmlmepriv->assoc_req, &pmlmepriv->assoc_req_len, (u8 *)pwlanhdr, pattrib->pktlen);
 	else
-		rtw_buf_free(&pmlmepriv->assoc_req, &pmlmepriv->assoc_req_len);
+		kfree(pmlmepriv->assoc_req);
 }
 
 /* when wait_ack is ture, this function shoule be called at process context */
diff --git a/drivers/staging/r8188eu/include/osdep_service.h b/drivers/staging/r8188eu/include/osdep_service.h
index cb876b50d68c..10f0203fd905 100644
--- a/drivers/staging/r8188eu/include/osdep_service.h
+++ b/drivers/staging/r8188eu/include/osdep_service.h
@@ -370,7 +370,6 @@ void rtw_free_netdev(struct net_device *netdev);
 		(a)[3] = (u8) (((u32) (val)) & 0xff);		\
 	} while (0)
 
-void rtw_buf_free(u8 **buf, u32 *buf_len);
 void rtw_buf_update(u8 **buf, u32 *buf_len, u8 *src, u32 src_len);
 
 struct rtw_cbuf {
diff --git a/drivers/staging/r8188eu/os_dep/osdep_service.c b/drivers/staging/r8188eu/os_dep/osdep_service.c
index db6ee1dca48e..232d3a337be4 100644
--- a/drivers/staging/r8188eu/os_dep/osdep_service.c
+++ b/drivers/staging/r8188eu/os_dep/osdep_service.c
@@ -283,13 +283,6 @@ int rtw_change_ifname(struct adapter *padapter, const char *ifname)
 	return -1;
 }
 
-void rtw_buf_free(u8 **buf, u32 *buf_len)
-{
-	*buf_len = 0;
-	kfree(*buf);
-	*buf = NULL;
-}
-
 void rtw_buf_update(u8 **buf, u32 *buf_len, u8 *src, u32 src_len)
 {
 	u32 dup_len = 0;
-- 
2.32.0


      parent reply	other threads:[~2021-08-05 18:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-05 18:37 [PATCH 0/5] Do more cleanups Larry Finger
2021-08-05 18:37 ` [PATCH 1/5] staging: r8188eu: Remove wrappers for kalloc() and kzalloc() Larry Finger
2021-08-06 11:07   ` Dan Carpenter
2021-08-05 18:37 ` [PATCH 2/5] staging: r8188eu: Remove wrapper around vfree Larry Finger
2021-08-05 18:37 ` [PATCH 3/5] staging: r8188eu: Remove all calls to _rtw_spinlock_free() Larry Finger
2021-08-05 18:37 ` [PATCH 4/5] staging: r8188eu: Remove more empty routines Larry Finger
2021-08-05 18:37 ` Larry Finger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210805183717.23007-6-Larry.Finger@lwfinger.net \
    --to=larry.finger@lwfinger.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=phil@philpotter.co.uk \
    --subject='Re: [PATCH 5/5] staging: r8188eu: Remove rtw_buf_free()' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).