lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 23 Dec 2021 01:14:07 +0000 (UTC)
From:   David Mosberger-Tang <davidm@...uge.net>
To:     Ajay Singh <ajay.kathat@...rochip.com>
Cc:     Claudiu Beznea <claudiu.beznea@...rochip.com>,
        Kalle Valo <kvalo@...nel.org>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        linux-wireless@...r.kernel.org, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        David Mosberger-Tang <davidm@...uge.net>
Subject: [PATCH v2 41/50] wilc1000: use more descriptive variable name

Now that the factoring is done, again rename "i" to "vmm_table_len" to
improve readability.

Signed-off-by: David Mosberger-Tang <davidm@...uge.net>
---
 .../net/wireless/microchip/wilc1000/wlan.c    | 31 +++++++++----------
 1 file changed, 14 insertions(+), 17 deletions(-)

diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c
index f01f7bade6189..f89ea4839aa61 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.c
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.c
@@ -681,7 +681,7 @@ static void set_header(struct wilc *wilc, struct sk_buff *tqe,
  * WILC_VMM_TBL_SIZE packets or up to WILC_TX_BUFF_SIZE bytes.
  */
 static int schedule_packets(struct wilc *wilc,
-			    int i, u32 vmm_table[WILC_VMM_TBL_SIZE])
+			    int vmm_table_len, u32 vmm_table[WILC_VMM_TBL_SIZE])
 {
 	u8 k, ac;
 	static const u8 ac_preserve_ratio[NQUEUES] = {1, 1, 1, 1};
@@ -702,8 +702,8 @@ static int schedule_packets(struct wilc *wilc,
 
 			ac_exist = 1;
 			for (k = 0; k < num_pkts_to_add[ac]; k++) {
-				if (i >= WILC_VMM_TBL_SIZE - 1)
-					return i;
+				if (vmm_table_len >= WILC_VMM_TBL_SIZE - 1)
+					return vmm_table_len;
 
 				tqe = skb_dequeue(&wilc->txq[ac]);
 				if (!tqe)
@@ -717,21 +717,21 @@ static int schedule_packets(struct wilc *wilc,
 				if (wilc->chipq_bytes + vmm_sz > WILC_TX_BUFF_SIZE) {
 					/* return packet to its queue */
 					skb_queue_head(&wilc->txq[ac], tqe);
-					return i;
+					return vmm_table_len;
 				}
 				atomic_dec(&wilc->txq_entries);
 
 				__skb_queue_tail(&wilc->chipq, tqe);
 				wilc->chipq_bytes += tqe->len;
 
-				vmm_table[i] = vmm_table_entry(tqe, vmm_sz);
-				i++;
+				vmm_table[vmm_table_len] = vmm_table_entry(tqe, vmm_sz);
+				vmm_table_len++;
 
 			}
 		}
 		num_pkts_to_add = ac_preserve_ratio;
 	} while (ac_exist);
-	return i;
+	return vmm_table_len;
 }
 
 /**
@@ -747,13 +747,10 @@ static int schedule_packets(struct wilc *wilc,
  */
 static int fill_vmm_table(struct wilc *wilc, u32 vmm_table[WILC_VMM_TBL_SIZE])
 {
-	int i;
-	int vmm_sz = 0;
+	int vmm_table_len = 0, vmm_sz = 0;
 	struct sk_buff *tqe;
 	struct wilc_skb_tx_cb *tx_cb;
 
-	i = 0;
-
 	if (unlikely(wilc->chipq_bytes > 0)) {
 		/* fill in packets that are already on the chipq: */
 		skb_queue_walk(&wilc->chipq, tqe) {
@@ -761,16 +758,16 @@ static int fill_vmm_table(struct wilc *wilc, u32 vmm_table[WILC_VMM_TBL_SIZE])
 			vmm_sz = tx_hdr_len(tx_cb->type);
 			vmm_sz += tqe->len;
 			vmm_sz = ALIGN(vmm_sz, 4);
-			vmm_table[i++] = vmm_table_entry(tqe, vmm_sz);
+			vmm_table[vmm_table_len++] = vmm_table_entry(tqe, vmm_sz);
 		}
 	}
 
-	i = schedule_packets(wilc, i, vmm_table);
-	if (i > 0) {
-		WARN_ON(i >= WILC_VMM_TBL_SIZE);
-		vmm_table[i] = 0x0;
+	vmm_table_len = schedule_packets(wilc, vmm_table_len, vmm_table);
+	if (vmm_table_len > 0) {
+		WARN_ON(vmm_table_len >= WILC_VMM_TBL_SIZE);
+		vmm_table[vmm_table_len] = 0x0;
 	}
-	return i;
+	return vmm_table_len;
 }
 
 /**
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ