Skip to contentSkip to conversation

block: elevator: remove unneeded null check in elv_register()

PATCH In review John Pittman 2 participants 3 messages Aug 30, 2018 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: elevator: remove unneeded null check in elv_register()

Since commit 3942d2991852 ("mm/slab_common: allow NULL cache pointer in kmem_cache_destroy()"), the kmem_cache_destroy() function has been able to handle null pointers. Remove NULL check against e->icq_cache in elv_register(), simplifying the code.

---
 block/elevator.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
block/elevator.c +1 -2
index 5ea6e7d600e4..6a06b5d040e5 100644
@@ -895,8 +895,7 @@ int elv_register(struct elevator_type *e)
 	spin_lock(&elv_list_lock);
 	if (elevator_find(e->elevator_name, e->uses_mq)) {
 		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);
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 4 lines · John Pittman

Since commit 3942d2991852 ("mm/slab_common: allow NULL cache pointer in kmem_cache_destroy()"), the kmem_cache_destroy() function has been able to handle null pointers. Remove NULL check against e->icq_cache in elv_register(), simplifying the code.

You're the 3rd person sending in this patch this week :-)

http://git.kernel.dk/cgit/linux-block/commit/?h=for-linus&id=62d2a1940709198a522a43ff8be8b8f6b3654dec

Signature · 1 line
Jens Axboe
#2 lore raw

Ha! Ok, thanks for reviewing Jens.

Quoted 13 lines · Jens Axboe
Quoted 4 lines · John Pittman

Since commit 3942d2991852 ("mm/slab_common: allow NULL cache pointer in kmem_cache_destroy()"), the kmem_cache_destroy() function has been able to handle null pointers. Remove NULL check against e->icq_cache in elv_register(), simplifying the code.

You're the 3rd person sending in this patch this week :-)

http://git.kernel.dk/cgit/linux-block/commit/?h=for-linus&id=62d2a1940709198a522a43ff8be8b8f6b3654dec

--
Jens Axboe