Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1448731
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] block: Delete an unnecessary check before the function call "kmem_cache_destroy" |
| Date | 2016-07-22 21:30 +0200 |
| Message-ID | <rXOiZ-1yn-5@gated-at.bofh.it> (permalink) |
| References | (12 earlier) <mSsDN-4wa-59@gated-at.bofh.it> <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> |
| Organization | linux.* mail to news gateway |
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
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[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
csiph-web