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

Honggang LI posted 1 patch 3 weeks, 1 day ago
drivers/nvme/target/rdma.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] nvmet-rdma: WARN_ON when nvmet_rdma_rsp::n_rdma equal zero
Posted by Honggang LI 3 weeks, 1 day ago
nvmet_rdma_rsp::n_rdma is an u8, which can't be negative.

Signed-off-by: Honggang LI <honggangli@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
Re: [PATCH] nvmet-rdma: WARN_ON when nvmet_rdma_rsp::n_rdma equal zero
Posted by Chaitanya Kulkarni 3 weeks ago
On 11/1/24 23:39, Honggang LI wrote:
> nvmet_rdma_rsp::n_rdma is an u8, which can't be negative.
>
> Signed-off-by: Honggang LI<honggangli@163.com>

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck