From dda78a882fd558304f16553732fd60af93434a87 Mon Sep 17 00:00:00 2001 From: John Levon Date: Thu, 8 Dec 2022 22:37:29 +0000 Subject: [PATCH] nvmf/vfio-user: fix _free_ctrlr() In _free_ctrlr(), ->endpoint can never be NULL, and the code was self-contradictory; assume it's not NULL. Signed-off-by: John Levon Change-Id: I81a449123ca05f64460380dc3a8ad8af2143d166 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15831 Tested-by: SPDK CI Jenkins Community-CI: Mellanox Build Bot Reviewed-by: Changpeng Liu Reviewed-by: Tomasz Zawadzki --- lib/nvmf/vfio_user.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/nvmf/vfio_user.c b/lib/nvmf/vfio_user.c index 917a14f63..6630bc28e 100644 --- a/lib/nvmf/vfio_user.c +++ b/lib/nvmf/vfio_user.c @@ -4253,7 +4253,7 @@ _free_ctrlr(void *ctx) struct nvmf_vfio_user_ctrlr *ctrlr = ctx; struct nvmf_vfio_user_endpoint *endpoint = ctrlr->endpoint; - free_sdbl(ctrlr->endpoint->vfu_ctx, ctrlr->sdbl); + free_sdbl(endpoint->vfu_ctx, ctrlr->sdbl); spdk_interrupt_unregister(&ctrlr->intr); ctrlr->intr_fd = -1; @@ -4261,10 +4261,6 @@ _free_ctrlr(void *ctx) free(ctrlr); - if (endpoint == NULL) { - return; - } - if (endpoint->need_async_destroy) { nvmf_vfio_user_destroy_endpoint(endpoint); } else if (endpoint->need_relisten) {