linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sh-DWARF: Delete unnecessary checks before the function call "mempool_destroy"
       [not found]                               ` <5317A59D.4@users.sourceforge.net>
@ 2015-11-16  7:28                                 ` SF Markus Elfring
  2016-07-19 16:20                                   ` SF Markus Elfring
  2016-07-19 21:08                                   ` SF Markus Elfring
  0 siblings, 2 replies; 5+ messages in thread
From: SF Markus Elfring @ 2015-11-16  7:28 UTC (permalink / raw)
  To: linux-kernel, linux-sh; +Cc: kernel-janitors, Julia Lawall

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 16 Nov 2015 08:20:36 +0100

The mempool_destroy() function tests whether its argument is NULL
and then returns immediately. Thus the test around the calls is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 arch/sh/kernel/dwarf.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/sh/kernel/dwarf.c b/arch/sh/kernel/dwarf.c
index 9d209a0..e1d751a 100644
--- a/arch/sh/kernel/dwarf.c
+++ b/arch/sh/kernel/dwarf.c
@@ -1009,10 +1009,8 @@ static void __init dwarf_unwinder_cleanup(void)
 	rbtree_postorder_for_each_entry_safe(cie, next_cie, &cie_root, node)
 		kfree(cie);
 
-	if (dwarf_reg_pool)
-		mempool_destroy(dwarf_reg_pool);
-	if (dwarf_frame_pool)
-		mempool_destroy(dwarf_frame_pool);
+	mempool_destroy(dwarf_reg_pool);
+	mempool_destroy(dwarf_frame_pool);
 	kmem_cache_destroy(dwarf_reg_cachep);
 	kmem_cache_destroy(dwarf_frame_cachep);
 }
-- 
2.6.2


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

* Re: [PATCH] sh-DWARF: Delete unnecessary checks before the function call "mempool_destroy"
  2015-11-16  7:28                                 ` [PATCH] sh-DWARF: Delete unnecessary checks before the function call "mempool_destroy" SF Markus Elfring
@ 2016-07-19 16:20                                   ` SF Markus Elfring
  2016-07-19 19:28                                     ` David Rientjes
  2016-07-19 21:08                                   ` SF Markus Elfring
  1 sibling, 1 reply; 5+ messages in thread
From: SF Markus Elfring @ 2016-07-19 16:20 UTC (permalink / raw)
  To: linux-kernel, linux-sh, David Rientjes; +Cc: kernel-janitors, Julia Lawall

> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 16 Nov 2015 08:20:36 +0100
> 
> The mempool_destroy() function tests whether its argument is NULL
> and then returns immediately. Thus the test around the calls is not needed.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  arch/sh/kernel/dwarf.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/sh/kernel/dwarf.c b/arch/sh/kernel/dwarf.c
> index 9d209a0..e1d751a 100644
> --- a/arch/sh/kernel/dwarf.c
> +++ b/arch/sh/kernel/dwarf.c
> @@ -1009,10 +1009,8 @@ static void __init dwarf_unwinder_cleanup(void)
>  	rbtree_postorder_for_each_entry_safe(cie, next_cie, &cie_root, node)
>  		kfree(cie);
>  
> -	if (dwarf_reg_pool)
> -		mempool_destroy(dwarf_reg_pool);
> -	if (dwarf_frame_pool)
> -		mempool_destroy(dwarf_frame_pool);
> +	mempool_destroy(dwarf_reg_pool);
> +	mempool_destroy(dwarf_frame_pool);
>  	kmem_cache_destroy(dwarf_reg_cachep);
>  	kmem_cache_destroy(dwarf_frame_cachep);
>  }
> 

How do you think about to integrate this update suggestion
into another source code repository?

Regards,
Markus

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

* Re: [PATCH] sh-DWARF: Delete unnecessary checks before the function call "mempool_destroy"
  2016-07-19 16:20                                   ` SF Markus Elfring
@ 2016-07-19 19:28                                     ` David Rientjes
  0 siblings, 0 replies; 5+ messages in thread
From: David Rientjes @ 2016-07-19 19:28 UTC (permalink / raw)
  To: SF Markus Elfring; +Cc: linux-kernel, linux-sh, kernel-janitors, Julia Lawall

On Tue, 19 Jul 2016, SF Markus Elfring wrote:

> > From: Markus Elfring <elfring@users.sourceforge.net>
> > Date: Mon, 16 Nov 2015 08:20:36 +0100
> > 
> > The mempool_destroy() function tests whether its argument is NULL
> > and then returns immediately. Thus the test around the calls is not needed.
> > 
> > This issue was detected by using the Coccinelle software.
> > 
> > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> > ---
> >  arch/sh/kernel/dwarf.c | 6 ++----
> >  1 file changed, 2 insertions(+), 4 deletions(-)
> > 
> > diff --git a/arch/sh/kernel/dwarf.c b/arch/sh/kernel/dwarf.c
> > index 9d209a0..e1d751a 100644
> > --- a/arch/sh/kernel/dwarf.c
> > +++ b/arch/sh/kernel/dwarf.c
> > @@ -1009,10 +1009,8 @@ static void __init dwarf_unwinder_cleanup(void)
> >  	rbtree_postorder_for_each_entry_safe(cie, next_cie, &cie_root, node)
> >  		kfree(cie);
> >  
> > -	if (dwarf_reg_pool)
> > -		mempool_destroy(dwarf_reg_pool);
> > -	if (dwarf_frame_pool)
> > -		mempool_destroy(dwarf_frame_pool);
> > +	mempool_destroy(dwarf_reg_pool);
> > +	mempool_destroy(dwarf_frame_pool);
> >  	kmem_cache_destroy(dwarf_reg_cachep);
> >  	kmem_cache_destroy(dwarf_frame_cachep);
> >  }
> > 
> 
> How do you think about to integrate this update suggestion
> into another source code repository?
> 

Your patch is fine, but you may want to send it to the maintainers 
directly to merge.

$ ./scripts/get_maintainer.pl -f arch/sh/kernel/dwarf.c
Yoshinori Sato <ysato@users.sourceforge.jp> (maintainer:SUPERH)
Rich Felker <dalias@libc.org> (maintainer:SUPERH)
linux-sh@vger.kernel.org (open list:SUPERH)
linux-kernel@vger.kernel.org (open list)

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

* Re: [PATCH] sh-DWARF: Delete unnecessary checks before the function call "mempool_destroy"
  2015-11-16  7:28                                 ` [PATCH] sh-DWARF: Delete unnecessary checks before the function call "mempool_destroy" SF Markus Elfring
  2016-07-19 16:20                                   ` SF Markus Elfring
@ 2016-07-19 21:08                                   ` SF Markus Elfring
  2016-07-22 15:31                                     ` Rich Felker
  1 sibling, 1 reply; 5+ messages in thread
From: SF Markus Elfring @ 2016-07-19 21:08 UTC (permalink / raw)
  To: Rich Felker, Yoshinori Sato, linux-sh
  Cc: LKML, kernel-janitors, Julia Lawall, David Rientjes

> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 16 Nov 2015 08:20:36 +0100
> 
> The mempool_destroy() function tests whether its argument is NULL
> and then returns immediately. Thus the test around the calls is not needed.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  arch/sh/kernel/dwarf.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/sh/kernel/dwarf.c b/arch/sh/kernel/dwarf.c
> index 9d209a0..e1d751a 100644
> --- a/arch/sh/kernel/dwarf.c
> +++ b/arch/sh/kernel/dwarf.c
> @@ -1009,10 +1009,8 @@ static void __init dwarf_unwinder_cleanup(void)
>  	rbtree_postorder_for_each_entry_safe(cie, next_cie, &cie_root, node)
>  		kfree(cie);
>  
> -	if (dwarf_reg_pool)
> -		mempool_destroy(dwarf_reg_pool);
> -	if (dwarf_frame_pool)
> -		mempool_destroy(dwarf_frame_pool);
> +	mempool_destroy(dwarf_reg_pool);
> +	mempool_destroy(dwarf_frame_pool);
>  	kmem_cache_destroy(dwarf_reg_cachep);
>  	kmem_cache_destroy(dwarf_frame_cachep);
>  }
> 

Would you like to integrate this update suggestion
into another source code repository?

Regards,
Markus

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

* Re: [PATCH] sh-DWARF: Delete unnecessary checks before the function call "mempool_destroy"
  2016-07-19 21:08                                   ` SF Markus Elfring
@ 2016-07-22 15:31                                     ` Rich Felker
  0 siblings, 0 replies; 5+ messages in thread
From: Rich Felker @ 2016-07-22 15:31 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: Yoshinori Sato, linux-sh, LKML, kernel-janitors, Julia Lawall,
	David Rientjes

On Tue, Jul 19, 2016 at 11:08:24PM +0200, SF Markus Elfring wrote:
> > From: Markus Elfring <elfring@users.sourceforge.net>
> > Date: Mon, 16 Nov 2015 08:20:36 +0100
> > 
> > The mempool_destroy() function tests whether its argument is NULL
> > and then returns immediately. Thus the test around the calls is not needed.
> > 
> > This issue was detected by using the Coccinelle software.
> > 
> > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> > ---
> >  arch/sh/kernel/dwarf.c | 6 ++----
> >  1 file changed, 2 insertions(+), 4 deletions(-)
> > 
> > diff --git a/arch/sh/kernel/dwarf.c b/arch/sh/kernel/dwarf.c
> > index 9d209a0..e1d751a 100644
> > --- a/arch/sh/kernel/dwarf.c
> > +++ b/arch/sh/kernel/dwarf.c
> > @@ -1009,10 +1009,8 @@ static void __init dwarf_unwinder_cleanup(void)
> >  	rbtree_postorder_for_each_entry_safe(cie, next_cie, &cie_root, node)
> >  		kfree(cie);
> >  
> > -	if (dwarf_reg_pool)
> > -		mempool_destroy(dwarf_reg_pool);
> > -	if (dwarf_frame_pool)
> > -		mempool_destroy(dwarf_frame_pool);
> > +	mempool_destroy(dwarf_reg_pool);
> > +	mempool_destroy(dwarf_frame_pool);
> >  	kmem_cache_destroy(dwarf_reg_cachep);
> >  	kmem_cache_destroy(dwarf_frame_cachep);
> >  }
> > 
> 
> Would you like to integrate this update suggestion
> into another source code repository?

Looks OK. I have it in my linux-sh tree to go upstream.

Rich

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

end of thread, other threads:[~2016-07-22 15:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <5307CAA2.8060406@users.sourceforge.net>
     [not found] ` <alpine.DEB.2.02.1402212321410.2043@localhost6.localdomain6>
     [not found]   ` <530A086E.8010901@users.sourceforge.net>
     [not found]     ` <alpine.DEB.2.02.1402231635510.1985@localhost6.localdomain6>
     [not found]       ` <530A72AA.3000601@users.sourceforge.net>
     [not found]         ` <alpine.DEB.2.02.1402240658210.2090@localhost6.localdomain6>
     [not found]           ` <530B5FB6.6010207@users.sourceforge.net>
     [not found]             ` <alpine.DEB.2.10.1402241710370.2074@hadrien>
     [not found]               ` <530C5E18.1020800@users.sourceforge.net>
     [not found]                 ` <alpine.DEB.2.10.1402251014170.2080@hadrien>
     [not found]                   ` <530CD2C4.4050903@users.sourceforge.net>
     [not found]                     ` <alpine.DEB.2.10.1402251840450.7035@hadrien>
     [not found]                       ` <530CF8FF.8080600@users.sourceforge.net>
     [not found]                         ` <alpine.DEB.2.02.1402252117150.2047@localhost6.localdomain6>
     [not found]                           ` <530DD06F.4090703@users.sourceforge.net>
     [not found]                             ` <alpine.DEB.2.02.1402262129250.2221@localhost6.localdomain6>
     [not found]                               ` <5317A59D.4@users.sourceforge.net>
2015-11-16  7:28                                 ` [PATCH] sh-DWARF: Delete unnecessary checks before the function call "mempool_destroy" SF Markus Elfring
2016-07-19 16:20                                   ` SF Markus Elfring
2016-07-19 19:28                                     ` David Rientjes
2016-07-19 21:08                                   ` SF Markus Elfring
2016-07-22 15:31                                     ` Rich Felker

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).