From d81d7a2c22063883e154586f742f642787dddb1a Mon Sep 17 00:00:00 2001 From: Ziye Yang Date: Tue, 23 Jun 2020 19:44:03 +0800 Subject: [PATCH] bdev/nvme: fix the compilation warning for unused variable. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The error message is: bdev_nvme.c:456:6: warning: variable ‘rc’ set but not used [-Wunused-but-set-variable] 456 | int rc; Reason: The CI testing pool will always use --enable-debug, but without this flag, we will see complilation warning. If we really want to catch this, it is better to really use this rc variable and print some information. Change-Id: Iec0ffcec4ec091d36044e3b36a9ac85e677b5c70 Signed-off-by: Ziye Yang Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3001 Reviewed-by: Changpeng Liu Reviewed-by: Aleksey Marchuk Reviewed-by: Shuhei Matsumoto Community-CI: Mellanox Build Bot Community-CI: Broadcom CI Tested-by: SPDK CI Jenkins --- module/bdev/nvme/bdev_nvme.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/module/bdev/nvme/bdev_nvme.c b/module/bdev/nvme/bdev_nvme.c index d77389efa8..0ba6944595 100644 --- a/module/bdev/nvme/bdev_nvme.c +++ b/module/bdev/nvme/bdev_nvme.c @@ -498,7 +498,12 @@ bdev_nvme_reset(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr, struct nvme_bdev_io *bi * Allows for round robin through multiple connections. */ rc = spdk_nvme_ctrlr_set_trid(nvme_bdev_ctrlr->ctrlr, &multipath_trid->trid); - assert(rc == 0); + if (rc) { + SPDK_ERRLOG("Failed to set the transport id for the nvme ctrlr=%p\n", + nvme_bdev_ctrlr->ctrlr); + /* Fail the application if the code comes here */ + assert(rc == 0); + } TAILQ_REMOVE(&nvme_bdev_ctrlr->multipath_trids, tmp_trid, link); TAILQ_INSERT_TAIL(&nvme_bdev_ctrlr->multipath_trids, tmp_trid, link); }