From: Heinrich Schuchardt <xypron.glpk@gmx.de>
Date: Wed, 8 Nov 2017 21:30:59 +0000 (+0100)
Subject: ubi: no NULL check needed before kmem_cache_destroy
X-Git-Tag: v2025.01-rc5-pxa1908~5372^2
X-Git-Url: http://git.dujemihanovic.xyz/img/html/index.html?a=commitdiff_plain;h=cd5f33e5fc832effd70866fccd629046a6dac265;p=u-boot.git

ubi: no NULL check needed before kmem_cache_destroy

kmem_cache_destroy calls free which checks for NULL.

Problem was indicated by coccinelle.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---

diff --git a/drivers/mtd/ubi/attach.c b/drivers/mtd/ubi/attach.c
index 90fb74a5c9..33c176a77b 100644
--- a/drivers/mtd/ubi/attach.c
+++ b/drivers/mtd/ubi/attach.c
@@ -1205,8 +1205,7 @@ static void destroy_ai(struct ubi_attach_info *ai)
 		}
 	}
 
-	if (ai->aeb_slab_cache)
-		kmem_cache_destroy(ai->aeb_slab_cache);
+	kmem_cache_destroy(ai->aeb_slab_cache);
 
 	kfree(ai);
 }