[PATCH 2/3] net: octeontx: Remove unneeded test

Andrew Goodbody andrew.goodbody at linaro.org
Tue Aug 5 17:45:48 CEST 2025


In nicvf_cq_handler there is a test for !cqe_count which will return if
true so it is guaranteed that cqe_count will true after that point. This
makes the later test for cqe_count redundant so it can be removed.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody at linaro.org>
---
 drivers/net/octeontx/nicvf_main.c | 46 +++++++++++++++++++--------------------
 1 file changed, 22 insertions(+), 24 deletions(-)

diff --git a/drivers/net/octeontx/nicvf_main.c b/drivers/net/octeontx/nicvf_main.c
index 8021cd752b5..94e5d827614 100644
--- a/drivers/net/octeontx/nicvf_main.c
+++ b/drivers/net/octeontx/nicvf_main.c
@@ -273,31 +273,29 @@ int nicvf_cq_handler(struct nicvf *nic, void **ppkt, int *pkt_len)
 	cqe_head >>= 9;
 	cqe_head &= 0xFFFF;
 
-	if (cqe_count) {
-		/* Get the CQ descriptor */
-		cq_desc = (struct cqe_rx_t *)GET_CQ_DESC(cq, cqe_head);
-		cqe_head++;
-		cqe_head &= (cq->dmem.q_len - 1);
-
-		switch (cq_desc->cqe_type) {
-		case CQE_TYPE_RX:
-			debug("%s: Got Rx CQE\n", nic->dev->name);
-			*pkt_len = nicvf_rcv_pkt_handler(nic, cq, cq_desc,
-							 ppkt, CQE_TYPE_RX);
-			processed_rq_cqe++;
-			break;
-		case CQE_TYPE_SEND:
-			debug("%s: Got Tx CQE\n", nic->dev->name);
-			nicvf_snd_pkt_handler(nic, cq, cq_desc, CQE_TYPE_SEND);
-			processed_sq_cqe++;
-			break;
-		default:
-			debug("%s: Got CQ type %u\n", nic->dev->name,
-			      cq_desc->cqe_type);
-			break;
-		}
-		processed_cqe++;
+	/* Get the CQ descriptor */
+	cq_desc = (struct cqe_rx_t *)GET_CQ_DESC(cq, cqe_head);
+	cqe_head++;
+	cqe_head &= (cq->dmem.q_len - 1);
+
+	switch (cq_desc->cqe_type) {
+	case CQE_TYPE_RX:
+		debug("%s: Got Rx CQE\n", nic->dev->name);
+		*pkt_len = nicvf_rcv_pkt_handler(nic, cq, cq_desc,
+						 ppkt, CQE_TYPE_RX);
+		processed_rq_cqe++;
+		break;
+	case CQE_TYPE_SEND:
+		debug("%s: Got Tx CQE\n", nic->dev->name);
+		nicvf_snd_pkt_handler(nic, cq, cq_desc, CQE_TYPE_SEND);
+		processed_sq_cqe++;
+		break;
+	default:
+		debug("%s: Got CQ type %u\n", nic->dev->name,
+		      cq_desc->cqe_type);
+		break;
 	}
+	processed_cqe++;
 
 	/* Dequeue CQE */
 	nicvf_queue_reg_write(nic, NIC_QSET_CQ_0_7_DOOR,

-- 
2.39.5



More information about the U-Boot mailing list