Fix to the computation of available dequeue size.
Protects notably for possible negative scenarios when dequeuing
descriptors.

Fixes: e640f6cdfa84 ("baseband/acc200: add LDPC processing")
Cc: [email protected]

Signed-off-by: Hernan Vargas <[email protected]>
---
 drivers/baseband/acc/acc_common.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/baseband/acc/acc_common.h 
b/drivers/baseband/acc/acc_common.h
index 3d411cd25f..255e0971b8 100644
--- a/drivers/baseband/acc/acc_common.h
+++ b/drivers/baseband/acc/acc_common.h
@@ -1602,7 +1602,7 @@ acc_ring_avail_enq(struct acc_queue *q)
 static inline uint32_t
 acc_ring_avail_deq(struct acc_queue *q)
 {
-       return (q->sw_ring_depth + q->sw_ring_head - q->sw_ring_tail) & 
q->sw_ring_wrap_mask;
+       return (q->sw_ring_head - q->sw_ring_tail) & q->sw_ring_wrap_mask;
 }
 
 /* Check room in AQ for the enqueues batches into Qmgr */
-- 
2.34.1

Reply via email to