From f6fa387f5bb7da3032bccc4332b3817373244b8d Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Thu, 19 Apr 2018 13:11:11 -0700 Subject: [PATCH] vhost/nvme: remove pointless task NULL check task must be non-NULL in blk_unmap_complete_cb - it is retrieved from child->parent, which is always set to a known good task in the only call site. Change-Id: I28dce62d4cb586311dc87f988c01aa0e03665e4d Signed-off-by: Daniel Verkamp Reviewed-on: https://review.gerrithub.io/408393 Tested-by: SPDK Automated Test System Reviewed-by: Jim Harris Reviewed-by: Ben Walker --- lib/vhost/vhost_nvme.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/vhost/vhost_nvme.c b/lib/vhost/vhost_nvme.c index e50ea0d40..b2ded8387 100644 --- a/lib/vhost/vhost_nvme.c +++ b/lib/vhost/vhost_nvme.c @@ -343,15 +343,14 @@ blk_unmap_complete_cb(struct spdk_bdev_io *bdev_io, bool success, void *cb_arg) spdk_bdev_free_io(bdev_io); } - if (task) { - task->num_children--; - if (!success) { - task->success = false; - } - if (!task->num_children) { - blk_request_complete_cb(NULL, task->success, task); - } + task->num_children--; + if (!success) { + task->success = false; } + if (!task->num_children) { + blk_request_complete_cb(NULL, task->success, task); + } + STAILQ_INSERT_TAIL(&nvme->free_tasks, child, stailq); }