From: Chengguang Xu Date: Mon, 27 Aug 2018 23:31:11 +0000 (+0800) Subject: block: remove unnecessary condition check X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=62d2a1940709198a522a43ff8be8b8f6b3654dec;p=linux.git block: remove unnecessary condition check kmem_cache_destroy() can handle NULL pointer correctly, so there is no need to check e->icq_cache before calling kmem_cache_destroy(). Signed-off-by: Chengguang Xu Signed-off-by: Jens Axboe --- diff --git a/block/elevator.c b/block/elevator.c index 5ea6e7d600e46..6a06b5d040e5d 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -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);