All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] staging: wilc1000: handle few full driver review comments
@ 2020-01-17 10:31 Ajay.Kathat
  2020-01-17 10:31 ` [PATCH 1/4] staging: wilc1000: remove use of infinite loop conditions Ajay.Kathat
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Ajay.Kathat @ 2020-01-17 10:31 UTC (permalink / raw)
  To: linux-wireless; +Cc: devel, gregkh, Adham.Abozaeid, johannes, Ajay.Kathat

From: Ajay Singh <ajay.kathat@microchip.com>

The patch series contains changes to address the below code review
comments -

 1/ Avoid use of infinite loops.
 2/ Use separate header file to keep firmware related 'struct'.
 3/ Remove unused code.

Ajay Singh (4):
  staging: wilc1000: remove use of infinite loop conditions
  staging: wilc1000: move firmware API struct's to separate header file
  staging: wilc1000: added 'wilc_' prefix for 'struct assoc_resp' name
  staging: wilc1000: remove unused code prior to throughput enhancement
    in SPI

 drivers/staging/wilc1000/fw.h       | 119 +++++++++++++++++++++++
 drivers/staging/wilc1000/hif.c      |  90 +----------------
 drivers/staging/wilc1000/hif.h      |  19 ----
 drivers/staging/wilc1000/netdev.c   |   7 +-
 drivers/staging/wilc1000/netdev.h   |   1 -
 drivers/staging/wilc1000/spi.c      | 143 +--------------------------
 drivers/staging/wilc1000/wlan.c     |  79 ++++++---------
 drivers/staging/wilc1000/wlan_cfg.c | 144 ++++++++++------------------
 drivers/staging/wilc1000/wlan_if.h  |   1 +
 9 files changed, 209 insertions(+), 394 deletions(-)
 create mode 100644 drivers/staging/wilc1000/fw.h

-- 
2.24.0

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/4] staging: wilc1000: remove use of infinite loop conditions
  2020-01-17 10:31 [PATCH 0/4] staging: wilc1000: handle few full driver review comments Ajay.Kathat
@ 2020-01-17 10:31 ` Ajay.Kathat
  2020-01-24  6:04     ` Dan Carpenter
  2020-01-17 10:31 ` [PATCH 2/4] staging: wilc1000: move firmware API struct's to separate header file Ajay.Kathat
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Ajay.Kathat @ 2020-01-17 10:31 UTC (permalink / raw)
  To: linux-wireless; +Cc: devel, gregkh, Adham.Abozaeid, johannes, Ajay.Kathat

From: Ajay Singh <ajay.kathat@microchip.com>

Avoid the use of 'while (1)' infinite loop conditions. It's not
recommended to have infinite loop in kernel code because a small bug can
cause never ending loops so use terminator condition as suggested in
full driver review [1].

[1]. https://lore.kernel.org/linux-wireless/20191023100313.52B3F606CF@smtp.codeaurora.org/

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/netdev.c   |   7 +-
 drivers/staging/wilc1000/wlan.c     |  79 ++++++---------
 drivers/staging/wilc1000/wlan_cfg.c | 144 ++++++++++------------------
 3 files changed, 84 insertions(+), 146 deletions(-)

diff --git a/drivers/staging/wilc1000/netdev.c b/drivers/staging/wilc1000/netdev.c
index 3fd8e008f733..960dbc8d5173 100644
--- a/drivers/staging/wilc1000/netdev.c
+++ b/drivers/staging/wilc1000/netdev.c
@@ -837,7 +837,7 @@ static const struct net_device_ops wilc_netdev_ops = {
 void wilc_netdev_cleanup(struct wilc *wilc)
 {
 	struct wilc_vif *vif;
-	int srcu_idx;
+	int srcu_idx, ifc_cnt = 0;
 
 	if (!wilc)
 		return;
@@ -858,7 +858,7 @@ void wilc_netdev_cleanup(struct wilc *wilc)
 	flush_workqueue(wilc->hif_workqueue);
 	destroy_workqueue(wilc->hif_workqueue);
 
-	do {
+	while (ifc_cnt < WILC_NUM_CONCURRENT_IFC) {
 		mutex_lock(&wilc->vif_mutex);
 		if (wilc->vif_num <= 0) {
 			mutex_unlock(&wilc->vif_mutex);
@@ -871,7 +871,8 @@ void wilc_netdev_cleanup(struct wilc *wilc)
 		wilc->vif_num--;
 		mutex_unlock(&wilc->vif_mutex);
 		synchronize_srcu(&wilc->srcu);
-	} while (1);
+		ifc_cnt++;
+	}
 
 	wilc_wlan_cfg_deinit(wilc);
 	wlan_deinit_locks(wilc);
diff --git a/drivers/staging/wilc1000/wlan.c b/drivers/staging/wilc1000/wlan.c
index ba5446724c93..c32af7076012 100644
--- a/drivers/staging/wilc1000/wlan.c
+++ b/drivers/staging/wilc1000/wlan.c
@@ -499,37 +499,31 @@ int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count)
 	wilc_wlan_txq_filter_dup_tcp_ack(dev);
 	i = 0;
 	sum = 0;
-	do {
-		if (tqe && (i < (WILC_VMM_TBL_SIZE - 1))) {
-			if (tqe->type == WILC_CFG_PKT)
-				vmm_sz = ETH_CONFIG_PKT_HDR_OFFSET;
-
-			else if (tqe->type == WILC_NET_PKT)
-				vmm_sz = ETH_ETHERNET_HDR_OFFSET;
-
-			else
-				vmm_sz = HOST_HDR_OFFSET;
+	while (tqe && (i < (WILC_VMM_TBL_SIZE - 1))) {
+		if (tqe->type == WILC_CFG_PKT)
+			vmm_sz = ETH_CONFIG_PKT_HDR_OFFSET;
+		else if (tqe->type == WILC_NET_PKT)
+			vmm_sz = ETH_ETHERNET_HDR_OFFSET;
+		else
+			vmm_sz = HOST_HDR_OFFSET;
 
-			vmm_sz += tqe->buffer_size;
+		vmm_sz += tqe->buffer_size;
 
-			if (vmm_sz & 0x3)
-				vmm_sz = (vmm_sz + 4) & ~0x3;
+		if (vmm_sz & 0x3)
+			vmm_sz = (vmm_sz + 4) & ~0x3;
 
-			if ((sum + vmm_sz) > WILC_TX_BUFF_SIZE)
-				break;
+		if ((sum + vmm_sz) > WILC_TX_BUFF_SIZE)
+			break;
 
-			vmm_table[i] = vmm_sz / 4;
-			if (tqe->type == WILC_CFG_PKT)
-				vmm_table[i] |= BIT(10);
-			cpu_to_le32s(&vmm_table[i]);
+		vmm_table[i] = vmm_sz / 4;
+		if (tqe->type == WILC_CFG_PKT)
+			vmm_table[i] |= BIT(10);
+		cpu_to_le32s(&vmm_table[i]);
 
-			i++;
-			sum += vmm_sz;
-			tqe = wilc_wlan_txq_get_next(wilc, tqe);
-		} else {
-			break;
-		}
-	} while (1);
+		i++;
+		sum += vmm_sz;
+		tqe = wilc_wlan_txq_get_next(wilc, tqe);
+	}
 
 	if (i == 0)
 		goto out;
@@ -594,12 +588,8 @@ int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count)
 				break;
 			reg &= ~BIT(0);
 			ret = func->hif_write_reg(wilc, WILC_HOST_TX_CTRL, reg);
-			if (!ret)
-				break;
-			break;
 		}
-		break;
-	} while (1);
+	} while (0);
 
 	if (!ret)
 		goto out_release_bus;
@@ -725,9 +715,7 @@ static void wilc_wlan_handle_rx_buff(struct wilc *wilc, u8 *buffer, int size)
 			}
 		}
 		offset += tp_len;
-		if (offset >= size)
-			break;
-	} while (1);
+	} while (offset < size);
 }
 
 static void wilc_wlan_handle_rxq(struct wilc *wilc)
@@ -736,11 +724,7 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc)
 	u8 *buffer;
 	struct rxq_entry_t *rqe;
 
-	do {
-		if (wilc->quit) {
-			complete(&wilc->cfg_event);
-			break;
-		}
+	while (!wilc->quit) {
 		rqe = wilc_wlan_rxq_remove(wilc);
 		if (!rqe)
 			break;
@@ -750,7 +734,9 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc)
 		wilc_wlan_handle_rx_buff(wilc, buffer, size);
 
 		kfree(rqe);
-	} while (1);
+	}
+	if (wilc->quit)
+		complete(&wilc->cfg_event);
 }
 
 static void wilc_unknown_isr_ext(struct wilc *wilc)
@@ -969,21 +955,14 @@ void wilc_wlan_cleanup(struct net_device *dev)
 	struct wilc *wilc = vif->wilc;
 
 	wilc->quit = 1;
-	do {
-		tqe = wilc_wlan_txq_remove_from_head(dev);
-		if (!tqe)
-			break;
+	while ((tqe = wilc_wlan_txq_remove_from_head(dev))) {
 		if (tqe->tx_complete_func)
 			tqe->tx_complete_func(tqe->priv, 0);
 		kfree(tqe);
-	} while (1);
+	}
 
-	do {
-		rqe = wilc_wlan_rxq_remove(wilc);
-		if (!rqe)
-			break;
+	while ((rqe = wilc_wlan_rxq_remove(wilc)))
 		kfree(rqe);
-	} while (1);
 
 	kfree(wilc->rx_buffer);
 	wilc->rx_buffer = NULL;
diff --git a/drivers/staging/wilc1000/wlan_cfg.c b/drivers/staging/wilc1000/wlan_cfg.c
index 2538435b82fd..fe2a7ed8e5cd 100644
--- a/drivers/staging/wilc1000/wlan_cfg.c
+++ b/drivers/staging/wilc1000/wlan_cfg.c
@@ -137,6 +137,7 @@ static void wilc_wlan_parse_response_frame(struct wilc *wl, u8 *info, int size)
 {
 	u16 wid;
 	u32 len = 0, i = 0;
+	struct wilc_cfg *cfg = &wl->cfg;
 
 	while (size > 0) {
 		i = 0;
@@ -144,63 +145,42 @@ static void wilc_wlan_parse_response_frame(struct wilc *wl, u8 *info, int size)
 
 		switch (FIELD_GET(WILC_WID_TYPE, wid)) {
 		case WID_CHAR:
-			do {
-				if (wl->cfg.b[i].id == WID_NIL)
-					break;
-
-				if (wl->cfg.b[i].id == wid) {
-					wl->cfg.b[i].val = info[4];
-					break;
-				}
+			while (cfg->b[i].id != WID_NIL && cfg->b[i].id != wid)
 				i++;
-			} while (1);
+
+			if (cfg->b[i].id == wid)
+				cfg->b[i].val = info[4];
+
 			len = 3;
 			break;
 
 		case WID_SHORT:
-			do {
-				struct wilc_cfg_hword *hw = &wl->cfg.hw[i];
+			while (cfg->hw[i].id != WID_NIL && cfg->hw[i].id != wid)
+				i++;
 
-				if (hw->id == WID_NIL)
-					break;
+			if (cfg->hw[i].id == wid)
+				cfg->hw[i].val = get_unaligned_le16(&info[4]);
 
-				if (hw->id == wid) {
-					hw->val = get_unaligned_le16(&info[4]);
-					break;
-				}
-				i++;
-			} while (1);
 			len = 4;
 			break;
 
 		case WID_INT:
-			do {
-				struct wilc_cfg_word *w = &wl->cfg.w[i];
+			while (cfg->w[i].id != WID_NIL && cfg->w[i].id != wid)
+				i++;
 
-				if (w->id == WID_NIL)
-					break;
+			if (cfg->w[i].id == wid)
+				cfg->w[i].val = get_unaligned_le32(&info[4]);
 
-				if (w->id == wid) {
-					w->val = get_unaligned_le32(&info[4]);
-					break;
-				}
-				i++;
-			} while (1);
 			len = 6;
 			break;
 
 		case WID_STR:
-			do {
-				if (wl->cfg.s[i].id == WID_NIL)
-					break;
-
-				if (wl->cfg.s[i].id == wid) {
-					memcpy(wl->cfg.s[i].str, &info[2],
-					       (info[2] + 2));
-					break;
-				}
+			while (cfg->s[i].id != WID_NIL && cfg->s[i].id != wid)
 				i++;
-			} while (1);
+
+			if (cfg->s[i].id == wid)
+				memcpy(cfg->s[i].str, &info[2], info[2] + 2);
+
 			len = 2 + info[2];
 			break;
 
@@ -223,16 +203,12 @@ static void wilc_wlan_parse_info_frame(struct wilc *wl, u8 *info)
 	if (len == 1 && wid == WID_STATUS) {
 		int i = 0;
 
-		do {
-			if (wl->cfg.b[i].id == WID_NIL)
-				break;
-
-			if (wl->cfg.b[i].id == wid) {
-				wl->cfg.b[i].val = info[3];
-				break;
-			}
+		while (wl->cfg.b[i].id != WID_NIL &&
+		       wl->cfg.b[i].id != wid)
 			i++;
-		} while (1);
+
+		if (wl->cfg.b[i].id == wid)
+			wl->cfg.b[i].val = info[3];
 	}
 }
 
@@ -292,63 +268,45 @@ int wilc_wlan_cfg_get_val(struct wilc *wl, u16 wid, u8 *buffer,
 {
 	u8 type = FIELD_GET(WILC_WID_TYPE, wid);
 	int i, ret = 0;
+	struct wilc_cfg *cfg = &wl->cfg;
 
 	i = 0;
 	if (type == CFG_BYTE_CMD) {
-		do {
-			if (wl->cfg.b[i].id == WID_NIL)
-				break;
-
-			if (wl->cfg.b[i].id == wid) {
-				memcpy(buffer, &wl->cfg.b[i].val, 1);
-				ret = 1;
-				break;
-			}
+		while (cfg->b[i].id != WID_NIL && cfg->b[i].id != wid)
 			i++;
-		} while (1);
+
+		if (cfg->b[i].id == wid) {
+			memcpy(buffer, &cfg->b[i].val, 1);
+			ret = 1;
+		}
 	} else if (type == CFG_HWORD_CMD) {
-		do {
-			if (wl->cfg.hw[i].id == WID_NIL)
-				break;
-
-			if (wl->cfg.hw[i].id == wid) {
-				memcpy(buffer, &wl->cfg.hw[i].val, 2);
-				ret = 2;
-				break;
-			}
+		while (cfg->hw[i].id != WID_NIL && cfg->hw[i].id != wid)
 			i++;
-		} while (1);
+
+		if (cfg->hw[i].id == wid) {
+			memcpy(buffer, &cfg->hw[i].val, 2);
+			ret = 2;
+		}
 	} else if (type == CFG_WORD_CMD) {
-		do {
-			if (wl->cfg.w[i].id == WID_NIL)
-				break;
-
-			if (wl->cfg.w[i].id == wid) {
-				memcpy(buffer, &wl->cfg.w[i].val, 4);
-				ret = 4;
-				break;
-			}
+		while (cfg->w[i].id != WID_NIL && cfg->w[i].id != wid)
 			i++;
-		} while (1);
-	} else if (type == CFG_STR_CMD) {
-		do {
-			u32 id = wl->cfg.s[i].id;
 
-			if (id == WID_NIL)
-				break;
+		if (cfg->w[i].id == wid) {
+			memcpy(buffer, &cfg->w[i].val, 4);
+			ret = 4;
+		}
+	} else if (type == CFG_STR_CMD) {
+		while (cfg->s[i].id != WID_NIL && cfg->s[i].id != wid)
+			i++;
 
-			if (id == wid) {
-				u16 size = get_unaligned_le16(wl->cfg.s[i].str);
+		if (cfg->s[i].id == wid) {
+			u16 size = get_unaligned_le16(cfg->s[i].str);
 
-				if (buffer_size >= size) {
-					memcpy(buffer, &wl->cfg.s[i].str[2],
-					       size);
-					ret = size;
-				}
-				break;
+			if (buffer_size >= size) {
+				memcpy(buffer, &cfg->s[i].str[2], size);
+				ret = size;
 			}
-			i++;
-		} while (1);
+		}
 	}
 	return ret;
 }
-- 
2.24.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/4] staging: wilc1000: move firmware API struct's to separate header file
  2020-01-17 10:31 [PATCH 0/4] staging: wilc1000: handle few full driver review comments Ajay.Kathat
  2020-01-17 10:31 ` [PATCH 1/4] staging: wilc1000: remove use of infinite loop conditions Ajay.Kathat
@ 2020-01-17 10:31 ` Ajay.Kathat
  2020-01-17 10:31 ` [PATCH 3/4] staging: wilc1000: added 'wilc_' prefix for 'struct assoc_resp' name Ajay.Kathat
  2020-01-17 10:31 ` [PATCH 4/4] staging: wilc1000: remove unused code prior to throughput enhancement in SPI Ajay.Kathat
  3 siblings, 0 replies; 7+ messages in thread
From: Ajay.Kathat @ 2020-01-17 10:31 UTC (permalink / raw)
  To: linux-wireless; +Cc: devel, gregkh, Adham.Abozaeid, johannes, Ajay.Kathat

From: Ajay Singh <ajay.kathat@microchip.com>

It's recommended to keep the 'struct' used for passing data to firmware
in separate header file. So added 'fw.h' header file to keep struct's
used to pass data to firmware.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/fw.h      | 119 +++++++++++++++++++++++++++++
 drivers/staging/wilc1000/hif.c     |  88 ---------------------
 drivers/staging/wilc1000/hif.h     |  19 -----
 drivers/staging/wilc1000/netdev.h  |   1 -
 drivers/staging/wilc1000/wlan_if.h |   1 +
 5 files changed, 120 insertions(+), 108 deletions(-)
 create mode 100644 drivers/staging/wilc1000/fw.h

diff --git a/drivers/staging/wilc1000/fw.h b/drivers/staging/wilc1000/fw.h
new file mode 100644
index 000000000000..21d71a9e8b47
--- /dev/null
+++ b/drivers/staging/wilc1000/fw.h
@@ -0,0 +1,119 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries.
+ * All rights reserved.
+ */
+
+#ifndef WILC_FW_H
+#define WILC_FW_H
+
+#include <linux/ieee80211.h>
+
+#define WILC_MAX_NUM_STA			9
+#define WILC_MAX_RATES_SUPPORTED		12
+#define WILC_MAX_NUM_PMKIDS			16
+#define WILC_MAX_NUM_SCANNED_CH			14
+
+struct assoc_resp {
+	__le16 capab_info;
+	__le16 status_code;
+	__le16 aid;
+} __packed;
+
+struct wilc_pmkid {
+	u8 bssid[ETH_ALEN];
+	u8 pmkid[WLAN_PMKID_LEN];
+} __packed;
+
+struct wilc_pmkid_attr {
+	u8 numpmkid;
+	struct wilc_pmkid pmkidlist[WILC_MAX_NUM_PMKIDS];
+} __packed;
+
+struct wilc_reg_frame {
+	u8 reg;
+	u8 reg_id;
+	__le16 frame_type;
+} __packed;
+
+struct wilc_drv_handler {
+	__le32 handler;
+	u8 mode;
+} __packed;
+
+struct wilc_wep_key {
+	u8 index;
+	u8 key_len;
+	u8 key[0];
+} __packed;
+
+struct wilc_sta_wpa_ptk {
+	u8 mac_addr[ETH_ALEN];
+	u8 key_len;
+	u8 key[0];
+} __packed;
+
+struct wilc_ap_wpa_ptk {
+	u8 mac_addr[ETH_ALEN];
+	u8 index;
+	u8 key_len;
+	u8 key[0];
+} __packed;
+
+struct wilc_gtk_key {
+	u8 mac_addr[ETH_ALEN];
+	u8 rsc[8];
+	u8 index;
+	u8 key_len;
+	u8 key[0];
+} __packed;
+
+struct wilc_op_mode {
+	__le32 mode;
+} __packed;
+
+struct wilc_noa_opp_enable {
+	u8 ct_window;
+	u8 cnt;
+	__le32 duration;
+	__le32 interval;
+	__le32 start_time;
+} __packed;
+
+struct wilc_noa_opp_disable {
+	u8 cnt;
+	__le32 duration;
+	__le32 interval;
+	__le32 start_time;
+} __packed;
+
+struct wilc_join_bss_param {
+	char ssid[IEEE80211_MAX_SSID_LEN];
+	u8 ssid_terminator;
+	u8 bss_type;
+	u8 ch;
+	__le16 cap_info;
+	u8 sa[ETH_ALEN];
+	u8 bssid[ETH_ALEN];
+	__le16 beacon_period;
+	u8 dtim_period;
+	u8 supp_rates[WILC_MAX_RATES_SUPPORTED + 1];
+	u8 wmm_cap;
+	u8 uapsd_cap;
+	u8 ht_capable;
+	u8 rsn_found;
+	u8 rsn_grp_policy;
+	u8 mode_802_11i;
+	u8 p_suites[3];
+	u8 akm_suites[3];
+	u8 rsn_cap[2];
+	u8 noa_enabled;
+	__le32 tsf_lo;
+	u8 idx;
+	u8 opp_enabled;
+	union {
+		struct wilc_noa_opp_disable opp_dis;
+		struct wilc_noa_opp_enable opp_en;
+	};
+} __packed;
+#endif
diff --git a/drivers/staging/wilc1000/hif.c b/drivers/staging/wilc1000/hif.c
index 349e45d58ec9..1ee3d7274bd6 100644
--- a/drivers/staging/wilc1000/hif.c
+++ b/drivers/staging/wilc1000/hif.c
@@ -10,7 +10,6 @@
 #define WILC_HIF_CONNECT_TIMEOUT_MS             9500
 
 #define WILC_FALSE_FRMWR_CHANNEL		100
-#define WILC_MAX_RATES_SUPPORTED		12
 
 struct wilc_rcvd_mac_info {
 	u8 status;
@@ -27,48 +26,6 @@ struct wilc_del_all_sta {
 	u8 mac[WILC_MAX_NUM_STA][ETH_ALEN];
 };
 
-struct wilc_op_mode {
-	__le32 mode;
-};
-
-struct wilc_reg_frame {
-	u8 reg;
-	u8 reg_id;
-	__le16 frame_type;
-} __packed;
-
-struct wilc_drv_handler {
-	__le32 handler;
-	u8 mode;
-} __packed;
-
-struct wilc_wep_key {
-	u8 index;
-	u8 key_len;
-	u8 key[0];
-} __packed;
-
-struct wilc_sta_wpa_ptk {
-	u8 mac_addr[ETH_ALEN];
-	u8 key_len;
-	u8 key[0];
-} __packed;
-
-struct wilc_ap_wpa_ptk {
-	u8 mac_addr[ETH_ALEN];
-	u8 index;
-	u8 key_len;
-	u8 key[0];
-} __packed;
-
-struct wilc_gtk_key {
-	u8 mac_addr[ETH_ALEN];
-	u8 rsc[8];
-	u8 index;
-	u8 key_len;
-	u8 key[0];
-} __packed;
-
 union wilc_message_body {
 	struct wilc_rcvd_net_info net_info;
 	struct wilc_rcvd_mac_info mac_info;
@@ -86,51 +43,6 @@ struct host_if_msg {
 	bool is_sync;
 };
 
-struct wilc_noa_opp_enable {
-	u8 ct_window;
-	u8 cnt;
-	__le32 duration;
-	__le32 interval;
-	__le32 start_time;
-} __packed;
-
-struct wilc_noa_opp_disable {
-	u8 cnt;
-	__le32 duration;
-	__le32 interval;
-	__le32 start_time;
-} __packed;
-
-struct wilc_join_bss_param {
-	char ssid[IEEE80211_MAX_SSID_LEN];
-	u8 ssid_terminator;
-	u8 bss_type;
-	u8 ch;
-	__le16 cap_info;
-	u8 sa[ETH_ALEN];
-	u8 bssid[ETH_ALEN];
-	__le16 beacon_period;
-	u8 dtim_period;
-	u8 supp_rates[WILC_MAX_RATES_SUPPORTED + 1];
-	u8 wmm_cap;
-	u8 uapsd_cap;
-	u8 ht_capable;
-	u8 rsn_found;
-	u8 rsn_grp_policy;
-	u8 mode_802_11i;
-	u8 p_suites[3];
-	u8 akm_suites[3];
-	u8 rsn_cap[2];
-	u8 noa_enabled;
-	__le32 tsf_lo;
-	u8 idx;
-	u8 opp_enabled;
-	union {
-		struct wilc_noa_opp_disable opp_dis;
-		struct wilc_noa_opp_enable opp_en;
-	};
-} __packed;
-
 /* 'msg' should be free by the caller for syc */
 static struct host_if_msg*
 wilc_alloc_work(struct wilc_vif *vif, void (*work_fun)(struct work_struct *),
diff --git a/drivers/staging/wilc1000/hif.h b/drivers/staging/wilc1000/hif.h
index 22ee6fffd599..db9179171f05 100644
--- a/drivers/staging/wilc1000/hif.h
+++ b/drivers/staging/wilc1000/hif.h
@@ -17,14 +17,11 @@ enum {
 	WILC_CLIENT_MODE = 0x4
 };
 
-#define WILC_MAX_NUM_STA			9
-#define WILC_MAX_NUM_SCANNED_CH			14
 #define WILC_MAX_NUM_PROBED_SSID		10
 
 #define WILC_TX_MIC_KEY_LEN			8
 #define WILC_RX_MIC_KEY_LEN			8
 
-#define WILC_MAX_NUM_PMKIDS			16
 #define WILC_ADD_STA_LENGTH			40
 #define WILC_NUM_CONCURRENT_IFC			2
 
@@ -35,12 +32,6 @@ enum {
 
 #define WILC_MAX_ASSOC_RESP_FRAME_SIZE   256
 
-struct assoc_resp {
-	__le16 capab_info;
-	__le16 status_code;
-	__le16 aid;
-} __packed;
-
 struct rf_info {
 	u8 link_speed;
 	s8 rssi;
@@ -59,16 +50,6 @@ enum host_if_state {
 	HOST_IF_FORCE_32BIT		= 0xFFFFFFFF
 };
 
-struct wilc_pmkid {
-	u8 bssid[ETH_ALEN];
-	u8 pmkid[WLAN_PMKID_LEN];
-} __packed;
-
-struct wilc_pmkid_attr {
-	u8 numpmkid;
-	struct wilc_pmkid pmkidlist[WILC_MAX_NUM_PMKIDS];
-} __packed;
-
 struct cfg_param_attr {
 	u32 flag;
 	u16 short_retry_limit;
diff --git a/drivers/staging/wilc1000/netdev.h b/drivers/staging/wilc1000/netdev.h
index cd8f0d72caaa..d5f7a6037fbc 100644
--- a/drivers/staging/wilc1000/netdev.h
+++ b/drivers/staging/wilc1000/netdev.h
@@ -21,7 +21,6 @@
 #define FLOW_CONTROL_LOWER_THRESHOLD		128
 #define FLOW_CONTROL_UPPER_THRESHOLD		256
 
-#define WILC_MAX_NUM_PMKIDS			16
 #define PMKID_FOUND				1
 #define NUM_STA_ASSOCIATED			8
 
diff --git a/drivers/staging/wilc1000/wlan_if.h b/drivers/staging/wilc1000/wlan_if.h
index 7c7ee66c35f5..f85fd575136d 100644
--- a/drivers/staging/wilc1000/wlan_if.h
+++ b/drivers/staging/wilc1000/wlan_if.h
@@ -8,6 +8,7 @@
 #define WILC_WLAN_IF_H
 
 #include <linux/netdevice.h>
+#include "fw.h"
 
 /********************************************
  *
-- 
2.24.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/4] staging: wilc1000: added 'wilc_' prefix for 'struct assoc_resp' name
  2020-01-17 10:31 [PATCH 0/4] staging: wilc1000: handle few full driver review comments Ajay.Kathat
  2020-01-17 10:31 ` [PATCH 1/4] staging: wilc1000: remove use of infinite loop conditions Ajay.Kathat
  2020-01-17 10:31 ` [PATCH 2/4] staging: wilc1000: move firmware API struct's to separate header file Ajay.Kathat
@ 2020-01-17 10:31 ` Ajay.Kathat
  2020-01-17 10:31 ` [PATCH 4/4] staging: wilc1000: remove unused code prior to throughput enhancement in SPI Ajay.Kathat
  3 siblings, 0 replies; 7+ messages in thread
From: Ajay.Kathat @ 2020-01-17 10:31 UTC (permalink / raw)
  To: linux-wireless; +Cc: devel, gregkh, Adham.Abozaeid, johannes, Ajay.Kathat

From: Ajay Singh <ajay.kathat@microchip.com>

Use 'wilc_' prefix for 'assoc_resp' struct to have proper naming
convention.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/fw.h  | 2 +-
 drivers/staging/wilc1000/hif.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/fw.h b/drivers/staging/wilc1000/fw.h
index 21d71a9e8b47..a76e1dea4345 100644
--- a/drivers/staging/wilc1000/fw.h
+++ b/drivers/staging/wilc1000/fw.h
@@ -14,7 +14,7 @@
 #define WILC_MAX_NUM_PMKIDS			16
 #define WILC_MAX_NUM_SCANNED_CH			14
 
-struct assoc_resp {
+struct wilc_assoc_resp {
 	__le16 capab_info;
 	__le16 status_code;
 	__le16 aid;
diff --git a/drivers/staging/wilc1000/hif.c b/drivers/staging/wilc1000/hif.c
index 1ee3d7274bd6..658790bd465b 100644
--- a/drivers/staging/wilc1000/hif.c
+++ b/drivers/staging/wilc1000/hif.c
@@ -552,7 +552,7 @@ static s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len,
 {
 	u8 *ies;
 	u16 ies_len;
-	struct assoc_resp *res = (struct assoc_resp *)buffer;
+	struct wilc_assoc_resp *res = (struct wilc_assoc_resp *)buffer;
 
 	ret_conn_info->status = le16_to_cpu(res->status_code);
 	if (ret_conn_info->status == WLAN_STATUS_SUCCESS) {
-- 
2.24.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/4] staging: wilc1000: remove unused code prior to throughput enhancement in SPI
  2020-01-17 10:31 [PATCH 0/4] staging: wilc1000: handle few full driver review comments Ajay.Kathat
                   ` (2 preceding siblings ...)
  2020-01-17 10:31 ` [PATCH 3/4] staging: wilc1000: added 'wilc_' prefix for 'struct assoc_resp' name Ajay.Kathat
@ 2020-01-17 10:31 ` Ajay.Kathat
  3 siblings, 0 replies; 7+ messages in thread
From: Ajay.Kathat @ 2020-01-17 10:31 UTC (permalink / raw)
  To: linux-wireless; +Cc: devel, gregkh, Adham.Abozaeid, johannes, Ajay.Kathat

From: Ajay Singh <ajay.kathat@microchip.com>

The firmware now uses throughput enhancement code by default for SPI so
remove the previous implementation as its not used anymore. Removed the
use of 'has_thrpt_enh' element as its always true.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/spi.c | 143 +--------------------------------
 1 file changed, 4 insertions(+), 139 deletions(-)

diff --git a/drivers/staging/wilc1000/spi.c b/drivers/staging/wilc1000/spi.c
index 8694ab5fcb22..4b883a933b44 100644
--- a/drivers/staging/wilc1000/spi.c
+++ b/drivers/staging/wilc1000/spi.c
@@ -13,7 +13,6 @@
 struct wilc_spi {
 	int crc_off;
 	int nint;
-	int has_thrpt_enh;
 };
 
 static const struct wilc_hif_func wilc_hif_spi;
@@ -897,8 +896,6 @@ static int wilc_spi_init(struct wilc *wilc, bool resume)
 		return 0;
 	}
 
-	spi_priv->has_thrpt_enh = 1;
-
 	isinit = 1;
 
 	return 1;
@@ -906,154 +903,22 @@ static int wilc_spi_init(struct wilc *wilc, bool resume)
 
 static int wilc_spi_read_size(struct wilc *wilc, u32 *size)
 {
-	struct spi_device *spi = to_spi_device(wilc->dev);
-	struct wilc_spi *spi_priv = wilc->bus_data;
 	int ret;
 
-	if (spi_priv->has_thrpt_enh) {
-		ret = spi_internal_read(wilc, 0xe840 - WILC_SPI_REG_BASE,
-					size);
-		*size = *size  & IRQ_DMA_WD_CNT_MASK;
-	} else {
-		u32 tmp;
-		u32 byte_cnt;
-
-		ret = wilc_spi_read_reg(wilc, WILC_VMM_TO_HOST_SIZE,
-					&byte_cnt);
-		if (!ret) {
-			dev_err(&spi->dev,
-				"Failed read WILC_VMM_TO_HOST_SIZE ...\n");
-			return ret;
-		}
-		tmp = (byte_cnt >> 2) & IRQ_DMA_WD_CNT_MASK;
-		*size = tmp;
-	}
+	ret = spi_internal_read(wilc, 0xe840 - WILC_SPI_REG_BASE, size);
+	*size = *size & IRQ_DMA_WD_CNT_MASK;
 
 	return ret;
 }
 
 static int wilc_spi_read_int(struct wilc *wilc, u32 *int_status)
 {
-	struct spi_device *spi = to_spi_device(wilc->dev);
-	struct wilc_spi *spi_priv = wilc->bus_data;
-	int ret;
-	u32 tmp;
-	u32 byte_cnt;
-	bool unexpected_irq;
-	int j;
-	u32 unknown_mask;
-	u32 irq_flags;
-	int k = IRG_FLAGS_OFFSET + 5;
-
-	if (spi_priv->has_thrpt_enh)
-		return spi_internal_read(wilc, 0xe840 - WILC_SPI_REG_BASE,
-					 int_status);
-	ret = wilc_spi_read_reg(wilc, WILC_VMM_TO_HOST_SIZE, &byte_cnt);
-	if (!ret) {
-		dev_err(&spi->dev,
-			"Failed read WILC_VMM_TO_HOST_SIZE ...\n");
-		return ret;
-	}
-	tmp = (byte_cnt >> 2) & IRQ_DMA_WD_CNT_MASK;
-
-	j = 0;
-	do {
-		wilc_spi_read_reg(wilc, 0x1a90, &irq_flags);
-		tmp |= ((irq_flags >> 27) << IRG_FLAGS_OFFSET);
-
-		if (spi_priv->nint > 5) {
-			wilc_spi_read_reg(wilc, 0x1a94, &irq_flags);
-			tmp |= (((irq_flags >> 0) & 0x7) << k);
-		}
-
-		unknown_mask = ~((1ul << spi_priv->nint) - 1);
-
-		unexpected_irq = (tmp >> IRG_FLAGS_OFFSET) & unknown_mask;
-		if (unexpected_irq) {
-			dev_err(&spi->dev,
-				"Unexpected interrupt(2):j=%d,tmp=%x,mask=%x\n",
-				j, tmp, unknown_mask);
-		}
-
-		j++;
-	} while (unexpected_irq);
-
-	*int_status = tmp;
-
-	return ret;
+	return spi_internal_read(wilc, 0xe840 - WILC_SPI_REG_BASE, int_status);
 }
 
 static int wilc_spi_clear_int_ext(struct wilc *wilc, u32 val)
 {
-	struct spi_device *spi = to_spi_device(wilc->dev);
-	struct wilc_spi *spi_priv = wilc->bus_data;
-	int ret;
-	u32 flags;
-	u32 tbl_ctl;
-
-	if (spi_priv->has_thrpt_enh) {
-		return spi_internal_write(wilc, 0xe844 - WILC_SPI_REG_BASE,
-					  val);
-	}
-
-	flags = val & (BIT(MAX_NUM_INT) - 1);
-	if (flags) {
-		int i;
-
-		ret = 1;
-		for (i = 0; i < spi_priv->nint; i++) {
-			/*
-			 * No matter what you write 1 or 0,
-			 * it will clear interrupt.
-			 */
-			if (flags & 1)
-				ret = wilc_spi_write_reg(wilc,
-							 0x10c8 + i * 4, 1);
-			if (!ret)
-				break;
-			flags >>= 1;
-		}
-		if (!ret) {
-			dev_err(&spi->dev,
-				"Failed wilc_spi_write_reg, set reg %x ...\n",
-				0x10c8 + i * 4);
-			return ret;
-		}
-		for (i = spi_priv->nint; i < MAX_NUM_INT; i++) {
-			if (flags & 1)
-				dev_err(&spi->dev,
-					"Unexpected interrupt cleared %d...\n",
-					i);
-			flags >>= 1;
-		}
-	}
-
-	tbl_ctl = 0;
-	/* select VMM table 0 */
-	if (val & SEL_VMM_TBL0)
-		tbl_ctl |= BIT(0);
-	/* select VMM table 1 */
-	if (val & SEL_VMM_TBL1)
-		tbl_ctl |= BIT(1);
-
-	ret = wilc_spi_write_reg(wilc, WILC_VMM_TBL_CTL, tbl_ctl);
-	if (!ret) {
-		dev_err(&spi->dev, "fail write reg vmm_tbl_ctl...\n");
-		return ret;
-	}
-
-	if (val & EN_VMM) {
-		/*
-		 * enable vmm transfer.
-		 */
-		ret = wilc_spi_write_reg(wilc, WILC_VMM_CORE_CTL, 1);
-		if (!ret) {
-			dev_err(&spi->dev, "fail write reg vmm_core_ctl...\n");
-			return ret;
-		}
-	}
-
-	return ret;
+	return spi_internal_write(wilc, 0xe844 - WILC_SPI_REG_BASE, val);
 }
 
 static int wilc_spi_sync_ext(struct wilc *wilc, int nint)
-- 
2.24.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/4] staging: wilc1000: remove use of infinite loop conditions
  2020-01-17 10:31 ` [PATCH 1/4] staging: wilc1000: remove use of infinite loop conditions Ajay.Kathat
@ 2020-01-24  6:04     ` Dan Carpenter
  0 siblings, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2020-01-24  6:04 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 17122 bytes --]

Hey Ajay,

url:    https://github.com/0day-ci/linux/commits/Ajay-Kathat-microchip-com/staging-wilc1000-handle-few-full-driver-review-comments/20200118-064137
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 270f104ba26f0498aff85e5b002e2f4c2249c04b

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/staging/wilc1000/wlan.c:663 wilc_wlan_handle_txq() error: double unlocked 'wilc->hif_cs' (orig line 575)

# https://github.com/0day-ci/linux/commit/afb35a84bfc18d51ed5ffebd87d7f4cf07c3b44e
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout afb35a84bfc18d51ed5ffebd87d7f4cf07c3b44e
vim +663 drivers/staging/wilc1000/wlan.c

a41047962ac053 drivers/staging/wilc1000/wilc_wlan.c Chris Park         2016-02-04  528  	if (i == 0)
891256180aea96 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  529  		goto out;
ac087c82c4ec08 drivers/staging/wilc1000/wilc_wlan.c Leo Kim            2015-11-06  530  	vmm_table[i] = 0x0;
a41047962ac053 drivers/staging/wilc1000/wilc_wlan.c Chris Park         2016-02-04  531  
b997b84ffca6ab drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-11-12  532  	acquire_bus(wilc, WILC_BUS_ACQUIRE_AND_WAKEUP);

Acquire here.

c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  533  	counter = 0;
f782497c099102 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-16  534  	func = wilc->hif_func;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  535  	do {
f782497c099102 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-16  536  		ret = func->hif_read_reg(wilc, WILC_HOST_TX_CTRL, &reg);
133b22d694c7a4 drivers/staging/wilc1000/wilc_wlan.c Chris Park         2016-02-04  537  		if (!ret)
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  538  			break;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  539  
4ee4b9da2b0142 drivers/staging/wilc1000/wilc_wlan.c Elizabeth Ferdman  2016-09-30  540  		if ((reg & 0x1) == 0)
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  541  			break;
4ee4b9da2b0142 drivers/staging/wilc1000/wilc_wlan.c Elizabeth Ferdman  2016-09-30  542  
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  543  		counter++;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  544  		if (counter > 200) {
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  545  			counter = 0;
891256180aea96 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  546  			ret = func->hif_write_reg(wilc, WILC_HOST_TX_CTRL, 0);
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  547  			break;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  548  		}
67e2a07ed8008b drivers/staging/wilc1000/wilc_wlan.c Glen Lee           2015-12-21  549  	} while (!wilc->quit);
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  550  
39823a50ff371c drivers/staging/wilc1000/wilc_wlan.c Alison Schofield   2015-10-08  551  	if (!ret)
588bf3c1162604 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  552  		goto out_release_bus;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  553  
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  554  	timeout = 200;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  555  	do {
f782497c099102 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-16  556  		ret = func->hif_block_tx(wilc,
f782497c099102 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-16  557  					 WILC_VMM_TBL_RX_SHADOW_BASE,
f782497c099102 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-16  558  					 (u8 *)vmm_table,
f782497c099102 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-16  559  					 ((i + 1) * 4));
133b22d694c7a4 drivers/staging/wilc1000/wilc_wlan.c Chris Park         2016-02-04  560  		if (!ret)
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  561  			break;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  562  
f782497c099102 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-16  563  		ret = func->hif_write_reg(wilc, WILC_HOST_VMM_CTL, 0x2);
133b22d694c7a4 drivers/staging/wilc1000/wilc_wlan.c Chris Park         2016-02-04  564  		if (!ret)
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  565  			break;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  566  
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  567  		do {
891256180aea96 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  568  			ret = func->hif_read_reg(wilc, WILC_HOST_VMM_CTL, &reg);
133b22d694c7a4 drivers/staging/wilc1000/wilc_wlan.c Chris Park         2016-02-04  569  			if (!ret)
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  570  				break;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  571  			if ((reg >> 2) & 0x1) {
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  572  				entries = ((reg >> 3) & 0x3f);
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  573  				break;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  574  			}
b997b84ffca6ab drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-11-12 @575  			release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP);
                                                                                                                ^^^^^^^^^^^

Bus is released here.



c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  576  		} while (--timeout);
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  577  		if (timeout <= 0) {
891256180aea96 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  578  			ret = func->hif_write_reg(wilc, WILC_HOST_VMM_CTL, 0x0);
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  579  			break;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  580  		}
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  581  
39823a50ff371c drivers/staging/wilc1000/wilc_wlan.c Alison Schofield   2015-10-08  582  		if (!ret)
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  583  			break;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  584  
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  585  		if (entries == 0) {
891256180aea96 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  586  			ret = func->hif_read_reg(wilc, WILC_HOST_TX_CTRL, &reg);
133b22d694c7a4 drivers/staging/wilc1000/wilc_wlan.c Chris Park         2016-02-04  587  			if (!ret)
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  588  				break;
ffda203c0cf3b5 drivers/staging/wilc1000/wilc_wlan.c Anish Bhatt        2015-09-29  589  			reg &= ~BIT(0);
891256180aea96 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  590  			ret = func->hif_write_reg(wilc, WILC_HOST_TX_CTRL, reg);
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  591  		}
afb35a84bfc18d drivers/staging/wilc1000/wlan.c      Ajay Singh         2020-01-17  592  	} while (0);
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  593  
39823a50ff371c drivers/staging/wilc1000/wilc_wlan.c Alison Schofield   2015-10-08  594  	if (!ret)
588bf3c1162604 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  595  		goto out_release_bus;
                                                                                                        ^^^^^^^^^^^^^^^^^^^^

39823a50ff371c drivers/staging/wilc1000/wilc_wlan.c Alison Schofield   2015-10-08  596  
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  597  	if (entries == 0) {
68b4f745cf1963 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-11-12  598  		ret = -ENOBUFS;
588bf3c1162604 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  599  		goto out_release_bus;
                                                                                                        ^^^^^^^^^^^^^^^^^^^^
Released again in these gotos.

c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  600  	}
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  601  
b997b84ffca6ab drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-11-12  602  	release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP);
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  603  
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  604  	offset = 0;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  605  	i = 0;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  606  	do {
fbc2fe16afa3f3 drivers/staging/wilc1000/wilc_wlan.c Chaehyun Lim       2015-09-15  607  		u32 header, buffer_offset;
82059dcec99e50 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  608  		char *bssid;
82059dcec99e50 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  609  
82059dcec99e50 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  610  		tqe = wilc_wlan_txq_remove_from_head(dev);
82059dcec99e50 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  611  		if (!tqe)
82059dcec99e50 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  612  			break;
82059dcec99e50 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  613  
9bc061e8805487 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2019-06-26  614  		vif = tqe->vif;
82059dcec99e50 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  615  		if (vmm_table[i] == 0)
82059dcec99e50 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  616  			break;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  617  
02211edc9a1f71 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-08-01  618  		le32_to_cpus(&vmm_table[i]);
ac087c82c4ec08 drivers/staging/wilc1000/wilc_wlan.c Leo Kim            2015-11-06  619  		vmm_sz = (vmm_table[i] & 0x3ff);
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  620  		vmm_sz *= 4;
ab12d8c773f86c drivers/staging/wilc1000/wilc_wlan.c Leo Kim            2015-11-06  621  		header = (tqe->type << 31) |
ab12d8c773f86c drivers/staging/wilc1000/wilc_wlan.c Leo Kim            2015-11-06  622  			 (tqe->buffer_size << 15) |
ab12d8c773f86c drivers/staging/wilc1000/wilc_wlan.c Leo Kim            2015-11-06  623  			 vmm_sz;
78174adaf59e85 drivers/staging/wilc1000/wilc_wlan.c Chandra S Gorentla 2015-08-08  624  		if (tqe->type == WILC_MGMT_PKT)
ffda203c0cf3b5 drivers/staging/wilc1000/wilc_wlan.c Anish Bhatt        2015-09-29  625  			header |= BIT(30);
78174adaf59e85 drivers/staging/wilc1000/wilc_wlan.c Chandra S Gorentla 2015-08-08  626  		else
ffda203c0cf3b5 drivers/staging/wilc1000/wilc_wlan.c Anish Bhatt        2015-09-29  627  			header &= ~BIT(30);
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  628  
02211edc9a1f71 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-08-01  629  		cpu_to_le32s(&header);
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  630  		memcpy(&txb[offset], &header, 4);
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  631  		if (tqe->type == WILC_CFG_PKT) {
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  632  			buffer_offset = ETH_CONFIG_PKT_HDR_OFFSET;
590c0a39650f02 drivers/staging/wilc1000/wilc_wlan.c Leo Kim            2015-11-06  633  		} else if (tqe->type == WILC_NET_PKT) {
9bc061e8805487 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2019-06-26  634  			bssid = tqe->vif->bssid;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  635  			buffer_offset = ETH_ETHERNET_HDR_OFFSET;
1bbf6a6d4091af drivers/staging/wilc1000/wilc_wlan.c Aditya Shankar     2017-11-03  636  			memcpy(&txb[offset + 8], bssid, 6);
590c0a39650f02 drivers/staging/wilc1000/wilc_wlan.c Leo Kim            2015-11-06  637  		} else {
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  638  			buffer_offset = HOST_HDR_OFFSET;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  639  		}
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  640  
ab12d8c773f86c drivers/staging/wilc1000/wilc_wlan.c Leo Kim            2015-11-06  641  		memcpy(&txb[offset + buffer_offset],
ab12d8c773f86c drivers/staging/wilc1000/wilc_wlan.c Leo Kim            2015-11-06  642  		       tqe->buffer, tqe->buffer_size);
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  643  		offset += vmm_sz;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  644  		i++;
ac087c82c4ec08 drivers/staging/wilc1000/wilc_wlan.c Leo Kim            2015-11-06  645  		tqe->status = 1;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  646  		if (tqe->tx_complete_func)
82059dcec99e50 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  647  			tqe->tx_complete_func(tqe->priv, tqe->status);
f31e5584dc555f drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-09-04  648  		if (tqe->ack_idx != NOT_TCP_ACK &&
f31e5584dc555f drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-09-04  649  		    tqe->ack_idx < MAX_PENDING_ACKS)
f31e5584dc555f drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-09-04  650  			vif->ack_filter.pending_acks[tqe->ack_idx].txqe = NULL;
a18dd63047a86e drivers/staging/wilc1000/wilc_wlan.c Greg Kroah-Hartman 2015-09-03  651  		kfree(tqe);
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  652  	} while (--entries);
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  653  
b997b84ffca6ab drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-11-12  654  	acquire_bus(wilc, WILC_BUS_ACQUIRE_AND_WAKEUP);
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  655  
f782497c099102 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-16  656  	ret = func->hif_clear_int_ext(wilc, ENABLE_TX_VMM);
133b22d694c7a4 drivers/staging/wilc1000/wilc_wlan.c Chris Park         2016-02-04  657  	if (!ret)
588bf3c1162604 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  658  		goto out_release_bus;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  659  
f782497c099102 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-16  660  	ret = func->hif_block_tx_ext(wilc, 0, txb, offset);
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  661  
588bf3c1162604 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  662  out_release_bus:
b997b84ffca6ab drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-11-12 @663  	release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP);
891256180aea96 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  664  
891256180aea96 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  665  out:
334bed089d3d74 drivers/staging/wilc1000/wilc_wlan.c Binoy Jayan        2016-06-15  666  	mutex_unlock(&wilc->txq_add_to_head_cs);
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  667  
67e2a07ed8008b drivers/staging/wilc1000/wilc_wlan.c Glen Lee           2015-12-21  668  	*txq_count = wilc->txq_entries;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  669  	return ret;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  670  }

---
0-DAY kernel test infrastructure                 Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/4] staging: wilc1000: remove use of infinite loop conditions
@ 2020-01-24  6:04     ` Dan Carpenter
  0 siblings, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2020-01-24  6:04 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 17122 bytes --]

Hey Ajay,

url:    https://github.com/0day-ci/linux/commits/Ajay-Kathat-microchip-com/staging-wilc1000-handle-few-full-driver-review-comments/20200118-064137
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 270f104ba26f0498aff85e5b002e2f4c2249c04b

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/staging/wilc1000/wlan.c:663 wilc_wlan_handle_txq() error: double unlocked 'wilc->hif_cs' (orig line 575)

# https://github.com/0day-ci/linux/commit/afb35a84bfc18d51ed5ffebd87d7f4cf07c3b44e
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout afb35a84bfc18d51ed5ffebd87d7f4cf07c3b44e
vim +663 drivers/staging/wilc1000/wlan.c

a41047962ac053 drivers/staging/wilc1000/wilc_wlan.c Chris Park         2016-02-04  528  	if (i == 0)
891256180aea96 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  529  		goto out;
ac087c82c4ec08 drivers/staging/wilc1000/wilc_wlan.c Leo Kim            2015-11-06  530  	vmm_table[i] = 0x0;
a41047962ac053 drivers/staging/wilc1000/wilc_wlan.c Chris Park         2016-02-04  531  
b997b84ffca6ab drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-11-12  532  	acquire_bus(wilc, WILC_BUS_ACQUIRE_AND_WAKEUP);

Acquire here.

c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  533  	counter = 0;
f782497c099102 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-16  534  	func = wilc->hif_func;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  535  	do {
f782497c099102 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-16  536  		ret = func->hif_read_reg(wilc, WILC_HOST_TX_CTRL, &reg);
133b22d694c7a4 drivers/staging/wilc1000/wilc_wlan.c Chris Park         2016-02-04  537  		if (!ret)
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  538  			break;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  539  
4ee4b9da2b0142 drivers/staging/wilc1000/wilc_wlan.c Elizabeth Ferdman  2016-09-30  540  		if ((reg & 0x1) == 0)
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  541  			break;
4ee4b9da2b0142 drivers/staging/wilc1000/wilc_wlan.c Elizabeth Ferdman  2016-09-30  542  
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  543  		counter++;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  544  		if (counter > 200) {
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  545  			counter = 0;
891256180aea96 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  546  			ret = func->hif_write_reg(wilc, WILC_HOST_TX_CTRL, 0);
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  547  			break;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  548  		}
67e2a07ed8008b drivers/staging/wilc1000/wilc_wlan.c Glen Lee           2015-12-21  549  	} while (!wilc->quit);
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  550  
39823a50ff371c drivers/staging/wilc1000/wilc_wlan.c Alison Schofield   2015-10-08  551  	if (!ret)
588bf3c1162604 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  552  		goto out_release_bus;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  553  
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  554  	timeout = 200;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  555  	do {
f782497c099102 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-16  556  		ret = func->hif_block_tx(wilc,
f782497c099102 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-16  557  					 WILC_VMM_TBL_RX_SHADOW_BASE,
f782497c099102 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-16  558  					 (u8 *)vmm_table,
f782497c099102 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-16  559  					 ((i + 1) * 4));
133b22d694c7a4 drivers/staging/wilc1000/wilc_wlan.c Chris Park         2016-02-04  560  		if (!ret)
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  561  			break;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  562  
f782497c099102 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-16  563  		ret = func->hif_write_reg(wilc, WILC_HOST_VMM_CTL, 0x2);
133b22d694c7a4 drivers/staging/wilc1000/wilc_wlan.c Chris Park         2016-02-04  564  		if (!ret)
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  565  			break;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  566  
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  567  		do {
891256180aea96 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  568  			ret = func->hif_read_reg(wilc, WILC_HOST_VMM_CTL, &reg);
133b22d694c7a4 drivers/staging/wilc1000/wilc_wlan.c Chris Park         2016-02-04  569  			if (!ret)
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  570  				break;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  571  			if ((reg >> 2) & 0x1) {
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  572  				entries = ((reg >> 3) & 0x3f);
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  573  				break;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  574  			}
b997b84ffca6ab drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-11-12 @575  			release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP);
                                                                                                                ^^^^^^^^^^^

Bus is released here.



c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  576  		} while (--timeout);
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  577  		if (timeout <= 0) {
891256180aea96 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  578  			ret = func->hif_write_reg(wilc, WILC_HOST_VMM_CTL, 0x0);
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  579  			break;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  580  		}
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  581  
39823a50ff371c drivers/staging/wilc1000/wilc_wlan.c Alison Schofield   2015-10-08  582  		if (!ret)
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  583  			break;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  584  
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  585  		if (entries == 0) {
891256180aea96 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  586  			ret = func->hif_read_reg(wilc, WILC_HOST_TX_CTRL, &reg);
133b22d694c7a4 drivers/staging/wilc1000/wilc_wlan.c Chris Park         2016-02-04  587  			if (!ret)
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  588  				break;
ffda203c0cf3b5 drivers/staging/wilc1000/wilc_wlan.c Anish Bhatt        2015-09-29  589  			reg &= ~BIT(0);
891256180aea96 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  590  			ret = func->hif_write_reg(wilc, WILC_HOST_TX_CTRL, reg);
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  591  		}
afb35a84bfc18d drivers/staging/wilc1000/wlan.c      Ajay Singh         2020-01-17  592  	} while (0);
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  593  
39823a50ff371c drivers/staging/wilc1000/wilc_wlan.c Alison Schofield   2015-10-08  594  	if (!ret)
588bf3c1162604 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  595  		goto out_release_bus;
                                                                                                        ^^^^^^^^^^^^^^^^^^^^

39823a50ff371c drivers/staging/wilc1000/wilc_wlan.c Alison Schofield   2015-10-08  596  
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  597  	if (entries == 0) {
68b4f745cf1963 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-11-12  598  		ret = -ENOBUFS;
588bf3c1162604 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  599  		goto out_release_bus;
                                                                                                        ^^^^^^^^^^^^^^^^^^^^
Released again in these gotos.

c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  600  	}
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  601  
b997b84ffca6ab drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-11-12  602  	release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP);
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  603  
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  604  	offset = 0;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  605  	i = 0;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  606  	do {
fbc2fe16afa3f3 drivers/staging/wilc1000/wilc_wlan.c Chaehyun Lim       2015-09-15  607  		u32 header, buffer_offset;
82059dcec99e50 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  608  		char *bssid;
82059dcec99e50 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  609  
82059dcec99e50 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  610  		tqe = wilc_wlan_txq_remove_from_head(dev);
82059dcec99e50 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  611  		if (!tqe)
82059dcec99e50 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  612  			break;
82059dcec99e50 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  613  
9bc061e8805487 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2019-06-26  614  		vif = tqe->vif;
82059dcec99e50 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  615  		if (vmm_table[i] == 0)
82059dcec99e50 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  616  			break;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  617  
02211edc9a1f71 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-08-01  618  		le32_to_cpus(&vmm_table[i]);
ac087c82c4ec08 drivers/staging/wilc1000/wilc_wlan.c Leo Kim            2015-11-06  619  		vmm_sz = (vmm_table[i] & 0x3ff);
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  620  		vmm_sz *= 4;
ab12d8c773f86c drivers/staging/wilc1000/wilc_wlan.c Leo Kim            2015-11-06  621  		header = (tqe->type << 31) |
ab12d8c773f86c drivers/staging/wilc1000/wilc_wlan.c Leo Kim            2015-11-06  622  			 (tqe->buffer_size << 15) |
ab12d8c773f86c drivers/staging/wilc1000/wilc_wlan.c Leo Kim            2015-11-06  623  			 vmm_sz;
78174adaf59e85 drivers/staging/wilc1000/wilc_wlan.c Chandra S Gorentla 2015-08-08  624  		if (tqe->type == WILC_MGMT_PKT)
ffda203c0cf3b5 drivers/staging/wilc1000/wilc_wlan.c Anish Bhatt        2015-09-29  625  			header |= BIT(30);
78174adaf59e85 drivers/staging/wilc1000/wilc_wlan.c Chandra S Gorentla 2015-08-08  626  		else
ffda203c0cf3b5 drivers/staging/wilc1000/wilc_wlan.c Anish Bhatt        2015-09-29  627  			header &= ~BIT(30);
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  628  
02211edc9a1f71 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-08-01  629  		cpu_to_le32s(&header);
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  630  		memcpy(&txb[offset], &header, 4);
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  631  		if (tqe->type == WILC_CFG_PKT) {
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  632  			buffer_offset = ETH_CONFIG_PKT_HDR_OFFSET;
590c0a39650f02 drivers/staging/wilc1000/wilc_wlan.c Leo Kim            2015-11-06  633  		} else if (tqe->type == WILC_NET_PKT) {
9bc061e8805487 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2019-06-26  634  			bssid = tqe->vif->bssid;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  635  			buffer_offset = ETH_ETHERNET_HDR_OFFSET;
1bbf6a6d4091af drivers/staging/wilc1000/wilc_wlan.c Aditya Shankar     2017-11-03  636  			memcpy(&txb[offset + 8], bssid, 6);
590c0a39650f02 drivers/staging/wilc1000/wilc_wlan.c Leo Kim            2015-11-06  637  		} else {
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  638  			buffer_offset = HOST_HDR_OFFSET;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  639  		}
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  640  
ab12d8c773f86c drivers/staging/wilc1000/wilc_wlan.c Leo Kim            2015-11-06  641  		memcpy(&txb[offset + buffer_offset],
ab12d8c773f86c drivers/staging/wilc1000/wilc_wlan.c Leo Kim            2015-11-06  642  		       tqe->buffer, tqe->buffer_size);
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  643  		offset += vmm_sz;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  644  		i++;
ac087c82c4ec08 drivers/staging/wilc1000/wilc_wlan.c Leo Kim            2015-11-06  645  		tqe->status = 1;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  646  		if (tqe->tx_complete_func)
82059dcec99e50 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  647  			tqe->tx_complete_func(tqe->priv, tqe->status);
f31e5584dc555f drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-09-04  648  		if (tqe->ack_idx != NOT_TCP_ACK &&
f31e5584dc555f drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-09-04  649  		    tqe->ack_idx < MAX_PENDING_ACKS)
f31e5584dc555f drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-09-04  650  			vif->ack_filter.pending_acks[tqe->ack_idx].txqe = NULL;
a18dd63047a86e drivers/staging/wilc1000/wilc_wlan.c Greg Kroah-Hartman 2015-09-03  651  		kfree(tqe);
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  652  	} while (--entries);
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  653  
b997b84ffca6ab drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-11-12  654  	acquire_bus(wilc, WILC_BUS_ACQUIRE_AND_WAKEUP);
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  655  
f782497c099102 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-16  656  	ret = func->hif_clear_int_ext(wilc, ENABLE_TX_VMM);
133b22d694c7a4 drivers/staging/wilc1000/wilc_wlan.c Chris Park         2016-02-04  657  	if (!ret)
588bf3c1162604 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  658  		goto out_release_bus;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  659  
f782497c099102 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-16  660  	ret = func->hif_block_tx_ext(wilc, 0, txb, offset);
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  661  
588bf3c1162604 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  662  out_release_bus:
b997b84ffca6ab drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-11-12 @663  	release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP);
891256180aea96 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  664  
891256180aea96 drivers/staging/wilc1000/wilc_wlan.c Ajay Singh         2018-02-26  665  out:
334bed089d3d74 drivers/staging/wilc1000/wilc_wlan.c Binoy Jayan        2016-06-15  666  	mutex_unlock(&wilc->txq_add_to_head_cs);
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  667  
67e2a07ed8008b drivers/staging/wilc1000/wilc_wlan.c Glen Lee           2015-12-21  668  	*txq_count = wilc->txq_entries;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  669  	return ret;
c5c77ba18ea66a drivers/staging/wilc1000/wilc_wlan.c Johnny Kim         2015-05-11  670  }

---
0-DAY kernel test infrastructure                 Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-01-24  6:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-17 10:31 [PATCH 0/4] staging: wilc1000: handle few full driver review comments Ajay.Kathat
2020-01-17 10:31 ` [PATCH 1/4] staging: wilc1000: remove use of infinite loop conditions Ajay.Kathat
2020-01-24  6:04   ` Dan Carpenter
2020-01-24  6:04     ` Dan Carpenter
2020-01-17 10:31 ` [PATCH 2/4] staging: wilc1000: move firmware API struct's to separate header file Ajay.Kathat
2020-01-17 10:31 ` [PATCH 3/4] staging: wilc1000: added 'wilc_' prefix for 'struct assoc_resp' name Ajay.Kathat
2020-01-17 10:31 ` [PATCH 4/4] staging: wilc1000: remove unused code prior to throughput enhancement in SPI Ajay.Kathat

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.