block: remove unnecessary condition check
authorChengguang Xu <cgxu519@gmx.com>
Mon, 27 Aug 2018 23:31:11 +0000 (07:31 +0800)
committerJens Axboe <axboe@kernel.dk>
Tue, 28 Aug 2018 01:16:06 +0000 (19:16 -0600)
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 <cgxu519@gmx.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/elevator.c

index 5ea6e7d600e46edcd1eec808324640ab8b7099ed..6a06b5d040e5dd8ffab230a3f3ae74bfa6935233 100644 (file)
@@ -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);