This makes the code tighter and easier to understand.
Signed-off-by: David Mosberger-Tang <[email protected]>
---
drivers/net/wireless/microchip/wilc1000/wlan.c | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c
index a6064a85140b4..dc6608390591c 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.c
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.c
@@ -638,7 +638,7 @@ static int fill_vmm_table(const struct wilc *wilc,
u32 sum;
u8 ac_preserve_ratio[NQUEUES] = {1, 1, 1, 1};
u8 *num_pkts_to_add;
- bool max_size_over = 0, ac_exist = 0;
+ bool ac_exist = 0;
int vmm_sz = 0;
struct sk_buff *tqe_q[NQUEUES];
struct wilc_skb_tx_cb *tx_cb;
@@ -648,20 +648,17 @@ static int fill_vmm_table(const struct wilc *wilc,
i = 0;
sum = 0;
- max_size_over = 0;
num_pkts_to_add = ac_desired_ratio;
do {
ac_exist = 0;
- for (ac = 0; (ac < NQUEUES) && (!max_size_over); ac++) {
+ for (ac = 0; ac < NQUEUES; ac++) {
if (!tqe_q[ac])
continue;
ac_exist = 1;
- for (k = 0; (k < num_pkts_to_add[ac]) &&
- (!max_size_over) && tqe_q[ac]; k++) {
+ for (k = 0; (k < num_pkts_to_add[ac]) && tqe_q[ac]; k++) {
if (i >= (WILC_VMM_TBL_SIZE - 1)) {
- max_size_over = 1;
- break;
+ goto out;
}
tx_cb = WILC_SKB_TX_CB(tqe_q[ac]);
@@ -676,8 +673,7 @@ static int fill_vmm_table(const struct wilc *wilc,
vmm_sz = ALIGN(vmm_sz, 4);
if ((sum + vmm_sz) > WILC_TX_BUFF_SIZE) {
- max_size_over = 1;
- break;
+ goto out;
}
vmm_table[i] = vmm_sz / 4;
if (tx_cb->type == WILC_CFG_PKT)
@@ -693,8 +689,8 @@ static int fill_vmm_table(const struct wilc *wilc,
}
}
num_pkts_to_add = ac_preserve_ratio;
- } while (!max_size_over && ac_exist);
-
+ } while (ac_exist);
+out:
vmm_table[i] = 0x0;
return i;
}
--
2.25.1