diff mbox series

block: remove unnecessary condition check

Message ID 20180827233111.9324-1-cgxu519@gmx.com (mailing list archive)
State New, archived
Headers show
Series block: remove unnecessary condition check | expand

Commit Message

Chengguang Xu Aug. 27, 2018, 11:31 p.m. UTC
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>
---
 block/elevator.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Jens Axboe Aug. 28, 2018, 1:16 a.m. UTC | #1
On 8/27/18 5:31 PM, Chengguang Xu wrote:
> kmem_cache_destroy() can handle NULL pointer correctly, so there is
> no need to check e->icq_cache before calling kmem_cache_destroy().

Applied, thanks.
diff mbox series

Patch

diff --git a/block/elevator.c b/block/elevator.c
index 5ea6e7d600e4..6a06b5d040e5 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);