[PATCH] nvmet-rdma: WARN_ON when nvmet_rdma_rsp::n_rdma equal zero

Honggang LI honggangli at 163.com
Fri Nov 1 23:39:53 PDT 2024


nvmet_rdma_rsp::n_rdma is an u8, which can't be negative.

Signed-off-by: Honggang LI <honggangli at 163.com>
---
 drivers/nvme/target/rdma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c
index 1afd93026f9b..cdeb275a388b 100644
--- a/drivers/nvme/target/rdma.c
+++ b/drivers/nvme/target/rdma.c
@@ -750,7 +750,7 @@ static void nvmet_rdma_read_data_done(struct ib_cq *cq, struct ib_wc *wc)
 	struct nvmet_rdma_queue *queue = wc->qp->qp_context;
 	u16 status = 0;
 
-	WARN_ON(rsp->n_rdma <= 0);
+	WARN_ON(rsp->n_rdma == 0);
 	atomic_add(rsp->n_rdma, &queue->sq_wr_avail);
 	rsp->n_rdma = 0;
 
@@ -787,7 +787,7 @@ static void nvmet_rdma_write_data_done(struct ib_cq *cq, struct ib_wc *wc)
 	if (!IS_ENABLED(CONFIG_BLK_DEV_INTEGRITY))
 		return;
 
-	WARN_ON(rsp->n_rdma <= 0);
+	WARN_ON(rsp->n_rdma == 0);
 	atomic_add(rsp->n_rdma, &queue->sq_wr_avail);
 	rsp->n_rdma = 0;
 
-- 
2.47.0




More information about the Linux-nvme mailing list