All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: r8188eu: core: Remove rtw_mfree_all_stainfo()
@ 2021-08-02  0:55 Fabio M. De Francesco
  2021-08-04 13:01 ` Dan Carpenter
  0 siblings, 1 reply; 6+ messages in thread
From: Fabio M. De Francesco @ 2021-08-02  0:55 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Larry Finger, linux-staging, linux-kernel
  Cc: Fabio M. De Francesco

Remove rtw_mfree_all_stainfo() and the only line of code that calls
it. This function simply takes a spinlock and iterates over a list 
with no purpose. That iteration has no side effects.

Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
---
 drivers/staging/r8188eu/core/rtw_sta_mgt.c | 22 ----------------------
 1 file changed, 22 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_sta_mgt.c b/drivers/staging/r8188eu/core/rtw_sta_mgt.c
index feaf39fddf7c..dae845ace2ef 100644
--- a/drivers/staging/r8188eu/core/rtw_sta_mgt.c
+++ b/drivers/staging/r8188eu/core/rtw_sta_mgt.c
@@ -161,34 +161,12 @@ void rtw_mfree_stainfo(struct sta_info *psta)
 
 }
 
-/*  this function is used to free the memory of lock || sema for all stainfos */
-void rtw_mfree_all_stainfo(struct sta_priv *pstapriv);
-void rtw_mfree_all_stainfo(struct sta_priv *pstapriv)
-{
-	struct list_head *plist, *phead;
-	struct sta_info *psta = NULL;
-
-	spin_lock_bh(&pstapriv->sta_hash_lock);
-
-	phead = get_list_head(&pstapriv->free_sta_queue);
-	plist = phead->next;
-
-	while (phead != plist) {
-		psta = container_of(plist, struct sta_info, list);
-		plist = plist->next;
-	}
-
-	spin_unlock_bh(&pstapriv->sta_hash_lock);
-}
-
 static void rtw_mfree_sta_priv_lock(struct sta_priv *pstapriv)
 {
 #ifdef CONFIG_88EU_AP_MODE
 	struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
 #endif
 
-	 rtw_mfree_all_stainfo(pstapriv); /* be done before free sta_hash_lock */
-
 	_rtw_spinlock_free(&pstapriv->free_sta_queue.lock);
 
 	_rtw_spinlock_free(&pstapriv->sta_hash_lock);
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] staging: r8188eu: core: Remove rtw_mfree_all_stainfo()
  2021-08-02  0:55 [PATCH] staging: r8188eu: core: Remove rtw_mfree_all_stainfo() Fabio M. De Francesco
@ 2021-08-04 13:01 ` Dan Carpenter
  2021-08-04 15:12   ` Fabio M. De Francesco
       [not found]   ` <CAP71bdUDEX=B6Km9wZO1AyHpVzqqkGNw6xNvspBz3qUABSKMEQ@mail.gmail.com>
  0 siblings, 2 replies; 6+ messages in thread
From: Dan Carpenter @ 2021-08-04 13:01 UTC (permalink / raw)
  To: Fabio M. De Francesco
  Cc: Greg Kroah-Hartman, Larry Finger, linux-staging, linux-kernel

On Mon, Aug 02, 2021 at 02:55:17AM +0200, Fabio M. De Francesco wrote:
> Remove rtw_mfree_all_stainfo() and the only line of code that calls
> it. This function simply takes a spinlock and iterates over a list 
> with no purpose. That iteration has no side effects.
> 

I mean, it's pretty clearly supposed to free all the items on the list.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] staging: r8188eu: core: Remove rtw_mfree_all_stainfo()
  2021-08-04 13:01 ` Dan Carpenter
@ 2021-08-04 15:12   ` Fabio M. De Francesco
       [not found]   ` <CAP71bdUDEX=B6Km9wZO1AyHpVzqqkGNw6xNvspBz3qUABSKMEQ@mail.gmail.com>
  1 sibling, 0 replies; 6+ messages in thread
From: Fabio M. De Francesco @ 2021-08-04 15:12 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Greg Kroah-Hartman, Larry Finger, linux-staging, linux-kernel

On Wednesday, August 4, 2021 3:01:36 PM CEST Dan Carpenter wrote:
> On Mon, Aug 02, 2021 at 02:55:17AM +0200, Fabio M. De Francesco wrote:
> > Remove rtw_mfree_all_stainfo() and the only line of code that calls
> > it. This function simply takes a spinlock and iterates over a list
> > with no purpose. That iteration has no side effects.
> 
> I mean, it's pretty clearly supposed to free all the items on the list.
> 
Sorry, I'm not sure to understand what you required:
since rtw_mfree_all_stainfo() is supposed to free all the nodes on the list, 
should a better patch *really* delete those items (instead than simply get rid 
of the function itself)? 

Thanks,

Fabio
> 
> regards,
> dan carpenter





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] staging: r8188eu: core: Remove rtw_mfree_all_stainfo()
       [not found]   ` <CAP71bdUDEX=B6Km9wZO1AyHpVzqqkGNw6xNvspBz3qUABSKMEQ@mail.gmail.com>
@ 2021-08-04 18:10     ` Larry Finger
  2021-08-05 10:28       ` Dan Carpenter
  2021-08-05 11:47       ` Fabio M. De Francesco
  0 siblings, 2 replies; 6+ messages in thread
From: Larry Finger @ 2021-08-04 18:10 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Fabio M. De Francesco, Greg Kroah-Hartman, linux-staging, LKML

On 8/4/21 10:09 AM, Larry Finger wrote:
> In other Realtek drivers, the while loop has a call to rtw_mfree_stainfo(psta). 
> That routine does not exist in this driver, but I think it should. In a few rare 
> instances, the driver leaks some memory - this missing code may explain that. In 
> any case, this patch should be dropped as the fix will require testing.

After looking at the original code for several other drivers, routine 
rtw_mfree_stainfo() just ends up calling a couple of routines that free a 
spinlock. That operation for Windows and FreeBSD is not trivial, but for Linux, 
the routine does nothing. Thus, despite its name, rtw_mfree_stainfo() does not 
free anything, and it can be deleted.

The original patch is

Acked-by: Larry Finger <Larry.Finger@lwfinger.net>

Larry


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] staging: r8188eu: core: Remove rtw_mfree_all_stainfo()
  2021-08-04 18:10     ` Larry Finger
@ 2021-08-05 10:28       ` Dan Carpenter
  2021-08-05 11:47       ` Fabio M. De Francesco
  1 sibling, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2021-08-05 10:28 UTC (permalink / raw)
  To: Larry Finger
  Cc: Fabio M. De Francesco, Greg Kroah-Hartman, linux-staging, LKML

On Wed, Aug 04, 2021 at 01:10:37PM -0500, Larry Finger wrote:
> On 8/4/21 10:09 AM, Larry Finger wrote:
> > In other Realtek drivers, the while loop has a call to
> > rtw_mfree_stainfo(psta). That routine does not exist in this driver, but
> > I think it should. In a few rare instances, the driver leaks some memory
> > - this missing code may explain that. In any case, this patch should be
> > dropped as the fix will require testing.
> 
> After looking at the original code for several other drivers, routine
> rtw_mfree_stainfo() just ends up calling a couple of routines that free a
> spinlock. That operation for Windows and FreeBSD is not trivial, but for
> Linux, the routine does nothing. Thus, despite its name, rtw_mfree_stainfo()
> does not free anything, and it can be deleted.
> 
> The original patch is
> 
> Acked-by: Larry Finger <Larry.Finger@lwfinger.net>

Thanks, Larry!

Acked-by: Dan Carpenter <dan.carpenter@oracle.com>

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] staging: r8188eu: core: Remove rtw_mfree_all_stainfo()
  2021-08-04 18:10     ` Larry Finger
  2021-08-05 10:28       ` Dan Carpenter
@ 2021-08-05 11:47       ` Fabio M. De Francesco
  1 sibling, 0 replies; 6+ messages in thread
From: Fabio M. De Francesco @ 2021-08-05 11:47 UTC (permalink / raw)
  To: Dan Carpenter, Larry Finger; +Cc: Greg Kroah-Hartman, linux-staging, LKML

On Wednesday, August 4, 2021 8:10:37 PM CEST Larry Finger wrote:
> On 8/4/21 10:09 AM, Larry Finger wrote:
> 
> []
>
> After looking at the original code for several other drivers, routine
> rtw_mfree_stainfo() just ends up calling a couple of routines that free a
> spinlock. That operation for Windows and FreeBSD is not trivial, but for 
Linux,
> the routine does nothing. Thus, despite its name, rtw_mfree_stainfo() does 
not
> free anything, and it can be deleted.
> 
> The original patch is
> 
> Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
> 
> Larry

Larry, 

Thanks for looking at that routine and acking my patch,

Fabio




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-08-05 11:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-02  0:55 [PATCH] staging: r8188eu: core: Remove rtw_mfree_all_stainfo() Fabio M. De Francesco
2021-08-04 13:01 ` Dan Carpenter
2021-08-04 15:12   ` Fabio M. De Francesco
     [not found]   ` <CAP71bdUDEX=B6Km9wZO1AyHpVzqqkGNw6xNvspBz3qUABSKMEQ@mail.gmail.com>
2021-08-04 18:10     ` Larry Finger
2021-08-05 10:28       ` Dan Carpenter
2021-08-05 11:47       ` Fabio M. De Francesco

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.