[PATCH v2 6/9] Point tail_blk_ctl to the first node

Pontus Fuchs pontus.fuchs at gmail.com
Thu May 30 04:12:32 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 | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/dxe.c b/dxe.c
index 8a3a1e8..9b0573b 100644
--- a/dxe.c
+++ b/dxe.c
@@ -52,10 +52,10 @@ static int wcn36xx_dxe_allocate_ctl_block(struct wcn36xx_dxe_ch *ch)
 			return -ENOMEM;
 
 		cur_ctl->ctl_blk_order = i;
-		ch->tail_blk_ctl = cur_ctl;
 		if (i == 0) {
 			ch->head_blk_ctl = cur_ctl;
-		} else if (ch->desc_num - 1 == i){
+			ch->tail_blk_ctl = cur_ctl;
+		} else if (ch->desc_num - 1 == i) {
 			prev_ctl->next = cur_ctl;
 			cur_ctl->next = ch->head_blk_ctl;
 		} else {
@@ -69,11 +69,11 @@ 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 *ctl = ch->head_blk_ctl, *next;
-	while (1) {
+	int i;
+
+	for (i = 0; i < ch->desc_num; i++) {
 		next = ctl->next;
 		kfree(ctl);
-		if (ch->tail_blk_ctl == ctl)
-			break;
 		ctl = next;
 	}
 }
-- 
1.8.1.2




More information about the wcn36xx mailing list