diff mbox series

block: Fix unneeded NULL check

Message ID 1535441413-8583-1-git-send-email-dingxiang@cmss.chinamobile.com (mailing list archive)
State New, archived
Headers show
Series block: Fix unneeded NULL check | expand

Commit Message

Ding Xiang Aug. 28, 2018, 7:30 a.m. UTC
if icq_cache is null, kmem_cache_destroy will do nothing.
So, remove the null check.

Signed-off-by: Ding Xiang <dingxiang@cmss.chinamobile.com>
---
 block/elevator.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Jens Axboe Aug. 28, 2018, 2:38 p.m. UTC | #1
On 8/28/18 1:30 AM, Ding Xiang wrote:
> if icq_cache is null, kmem_cache_destroy will do nothing.
> So, remove the null check.

Identical patch is already queued up:

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

Patch

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