[PATCH v5 04/21] common/idpf: avoid defensive programming
Soumyadeep Hore
soumyadeep.hore at intel.com
Mon Jun 24 11:16:27 CEST 2024
Based on the upstream feedback, driver should not use any
defensive programming strategy by checking for NULL pointers
and other conditional checks unnecessarily in the code flow
to fall back, instead fail and fix the bug in a proper way.
As the control queue is freed and deleted from the list after the
idpf_ctlq_shutdown call, there is no need to have the ring_size
check in idpf_ctlq_shutdown.
Signed-off-by: Soumyadeep Hore <soumyadeep.hore at intel.com>
---
drivers/common/idpf/base/idpf_controlq.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/common/idpf/base/idpf_controlq.c b/drivers/common/idpf/base/idpf_controlq.c
index a82ca628de..d9ca33cdb9 100644
--- a/drivers/common/idpf/base/idpf_controlq.c
+++ b/drivers/common/idpf/base/idpf_controlq.c
@@ -98,9 +98,6 @@ static void idpf_ctlq_shutdown(struct idpf_hw *hw, struct idpf_ctlq_info *cq)
{
idpf_acquire_lock(&cq->cq_lock);
- if (!cq->ring_size)
- goto shutdown_sq_out;
-
#ifdef SIMICS_BUILD
wr32(hw, cq->reg.head, 0);
wr32(hw, cq->reg.tail, 0);
@@ -115,7 +112,6 @@ static void idpf_ctlq_shutdown(struct idpf_hw *hw, struct idpf_ctlq_info *cq)
/* Set ring_size to 0 to indicate uninitialized queue */
cq->ring_size = 0;
-shutdown_sq_out:
idpf_release_lock(&cq->cq_lock);
idpf_destroy_lock(&cq->cq_lock);
}
--
2.43.0
More information about the dev
mailing list