linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arch/x86: remove redundant null checks before kmem_cache_destroy
@ 2017-10-08  3:15 Tim Hansen
  2017-10-10  8:40 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Tim Hansen @ 2017-10-08  3:15 UTC (permalink / raw)
  To: pbonzini
  Cc: rkrcmar, tglx, mingo, hpa, x86, kvm, linux-kernel,
	alexander.levin, devtimhansen

Remove redundant null checks before calling kmem_cache_destroy.

Found with make coccicheck M=arch/x86/kvm on linux-next tag 
next-20170929.

Signed-off-by: Tim Hansen <devtimhansen@gmail.com>
---
 arch/x86/kvm/mmu.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index eca30c1eb1d9..a6c7177326c5 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -5463,10 +5463,8 @@ static struct shrinker mmu_shrinker = {
 
 static void mmu_destroy_caches(void)
 {
-	if (pte_list_desc_cache)
-		kmem_cache_destroy(pte_list_desc_cache);
-	if (mmu_page_header_cache)
-		kmem_cache_destroy(mmu_page_header_cache);
+	kmem_cache_destroy(pte_list_desc_cache);
+	kmem_cache_destroy(mmu_page_header_cache);
 }
 
 int kvm_mmu_module_init(void)
-- 
2.14.2

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

* Re: [PATCH] arch/x86: remove redundant null checks before kmem_cache_destroy
  2017-10-08  3:15 [PATCH] arch/x86: remove redundant null checks before kmem_cache_destroy Tim Hansen
@ 2017-10-10  8:40 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2017-10-10  8:40 UTC (permalink / raw)
  To: Tim Hansen
  Cc: rkrcmar, tglx, mingo, hpa, x86, kvm, linux-kernel, alexander.levin

On 08/10/2017 05:15, Tim Hansen wrote:
> Remove redundant null checks before calling kmem_cache_destroy.
> 
> Found with make coccicheck M=arch/x86/kvm on linux-next tag 
> next-20170929.
> 
> Signed-off-by: Tim Hansen <devtimhansen@gmail.com>
> ---
>  arch/x86/kvm/mmu.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
> index eca30c1eb1d9..a6c7177326c5 100644
> --- a/arch/x86/kvm/mmu.c
> +++ b/arch/x86/kvm/mmu.c
> @@ -5463,10 +5463,8 @@ static struct shrinker mmu_shrinker = {
>  
>  static void mmu_destroy_caches(void)
>  {
> -	if (pte_list_desc_cache)
> -		kmem_cache_destroy(pte_list_desc_cache);
> -	if (mmu_page_header_cache)
> -		kmem_cache_destroy(mmu_page_header_cache);
> +	kmem_cache_destroy(pte_list_desc_cache);
> +	kmem_cache_destroy(mmu_page_header_cache);
>  }
>  
>  int kvm_mmu_module_init(void)
> 

Queued, thanks.

Paolo

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

end of thread, other threads:[~2017-10-10  8:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-08  3:15 [PATCH] arch/x86: remove redundant null checks before kmem_cache_destroy Tim Hansen
2017-10-10  8:40 ` Paolo Bonzini

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