Skip to content

Commit

Permalink
block: remove unnecessary condition check
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Chengguang Xu authored and Jens Axboe committed Aug 28, 2018
1 parent 46cb52a commit 62d2a19
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions block/elevator.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 62d2a19

Please sign in to comment.