[PATCH 6/7] Point tail_blk_ctl to the first node

Pontus Fuchs pontus.fuchs at gmail.com
Tue May 28 10:59:08 EDT 2013


Commit d8d5445d moved assignment of tail_blk_ctl to point to the last
allocated node. This is incorrect as it should point to the first
unused node.

wcn36xx_dxe_free_ctl_block needs to be updated to reflect this change.
Simplify it while at it.

Signed-off-by: Pontus Fuchs <pontus.fuchs at gmail.com>
---
 dxe.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/dxe.c b/dxe.c
index a4780fe..0da108e 100644
--- a/dxe.c
+++ b/dxe.c
@@ -53,9 +53,9 @@ static int wcn36xx_dxe_allocate_ctl_block(struct wcn36xx_dxe_ch *ch)
 		}
 		cur_dxe_ctl->ctl_blk_order = i;
 
-		ch->tail_blk_ctl = cur_dxe_ctl;
 		if (i == 0) {
 			ch->head_blk_ctl = cur_dxe_ctl;
+			ch->tail_blk_ctl = cur_dxe_ctl;
 		} else if (ch->desc_num - 1 == i){
 			prev_dxe_ctl->next = cur_dxe_ctl;
 			cur_dxe_ctl->next = ch->head_blk_ctl;
@@ -69,13 +69,13 @@ static int wcn36xx_dxe_allocate_ctl_block(struct wcn36xx_dxe_ch *ch)
 
 static void wcn36xx_dxe_free_ctl_block(struct wcn36xx_dxe_ch *ch)
 {
-	struct wcn36xx_dxe_ctl *cur_dxe_ctl = ch->head_blk_ctl, *next;
-	while (1) {
-		next = cur_dxe_ctl->next;
-		kfree(cur_dxe_ctl);
-		if (ch->tail_blk_ctl == cur_dxe_ctl)
-			break;
-		cur_dxe_ctl = next;
+	struct wcn36xx_dxe_ctl *cur = ch->head_blk_ctl, *next;
+	int i;
+
+	for (i = 0; i < ch->desc_num; i++) {
+		next = cur->next;
+		kfree(cur);
+		cur = next;
 	}
 }
 
-- 
1.8.1.2




More information about the wcn36xx mailing list