Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1270611

[PATCH 1/3] ste_dma40: Delete an unnecessary check before the function call "kmem_cache_destroy"

From SF Markus Elfring <elfring@users.sourceforge.net>
Newsgroups linux.kernel
Subject [PATCH 1/3] ste_dma40: Delete an unnecessary check before the function call "kmem_cache_destroy"
Date 2015-11-16 22:30 +0100
Message-ID <qvzvC-4cE-65@gated-at.bofh.it> (permalink)
References (13 earlier) <mSsDN-4wa-61@gated-at.bofh.it> <mSsDN-4wa-63@gated-at.bofh.it> <mSsDN-4wa-65@gated-at.bofh.it> <mSsDN-4wa-33@gated-at.bofh.it> <qvzvz-4cE-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

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

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/dma/ste_dma40.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index dd3e7ba..9132ae0 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -3694,8 +3694,7 @@ static int __init d40_probe(struct platform_device *pdev)
 
 failure:
 	if (base) {
-		if (base->desc_slab)
-			kmem_cache_destroy(base->desc_slab);
+		kmem_cache_destroy(base->desc_slab);
 		if (base->virtbase)
 			iounmap(base->virtbase);
 
-- 
2.6.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/3] ste_dma40: Deletion of a few unnecessary checks SF Markus Elfring <elfring@users.sourceforge.net> - 2015-11-16 22:30 +0100
  [PATCH 3/3] ste_dma40: Delete an unnecessary variable initialisation  in d40_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2015-11-16 22:30 +0100
    Re: [PATCH 3/3] ste_dma40: Delete an unnecessary variable  initialisation in d40_probe() Linus Walleij <linus.walleij@linaro.org> - 2015-11-29 22:30 +0100
  [PATCH 1/3] ste_dma40: Delete an unnecessary check before the  function call "kmem_cache_destroy" SF Markus Elfring <elfring@users.sourceforge.net> - 2015-11-16 22:30 +0100
    Re: [PATCH 1/3] ste_dma40: Delete an unnecessary check before the  function call "kmem_cache_destroy" Linus Walleij <linus.walleij@linaro.org> - 2015-11-29 22:30 +0100

csiph-web