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


Groups > linux.kernel > #1448731 > unrolled thread

[PATCH] block: Delete an unnecessary check before the function call "kmem_cache_destroy"

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2016-07-22 21:30 +0200
Last post2016-07-22 21:30 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH] block: Delete an unnecessary check before the function call  "kmem_cache_destroy" SF Markus Elfring <elfring@users.sourceforge.net> - 2016-07-22 21:30 +0200

#1448731 — [PATCH] block: Delete an unnecessary check before the function call "kmem_cache_destroy"

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-07-22 21:30 +0200
Subject[PATCH] block: Delete an unnecessary check before the function call "kmem_cache_destroy"
Message-ID<rXOiZ-1yn-5@gated-at.bofh.it>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 22 Jul 2016 21:07:37 +0200

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>
---
 block/elevator.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/block/elevator.c b/block/elevator.c
index 7096c22..29dc177 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -846,8 +846,7 @@ int elv_register(struct elevator_type *e)
 	spin_lock(&elv_list_lock);
 	if (elevator_find(e->elevator_name)) {
 		spin_unlock(&elv_list_lock);
-		if (e->icq_cache)
-			kmem_cache_destroy(e->icq_cache);
+		kmem_cache_destroy(e->icq_cache);
 		return -EBUSY;
 	}
 	list_add_tail(&e->list, &elv_list);
-- 
2.9.2

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web