Browse Source

Merge "qca-wifi: Reinitialize len in while loop"

Linux Build Service Account 5 years ago
parent
commit
21c27f8c0a
2 changed files with 6 additions and 4 deletions
  1. 3 2
      wmi/src/wmi_unified_ap_tlv.c
  2. 3 2
      wmi/src/wmi_unified_non_tlv.c

+ 3 - 2
wmi/src/wmi_unified_ap_tlv.c

@@ -2437,7 +2437,7 @@ send_peer_chan_width_switch_cmd_tlv(wmi_unified_t wmi_handle,
 {
 	wmi_buf_t buf;
 	wmi_peer_chan_width_switch_cmd_fixed_param *cmd;
-	int32_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE;
+	int32_t len;
 	uint32_t max_peers_per_command, max_peers_per_buf;
 	wmi_chan_width_peer_list *cmd_peer_list;
 	int16_t pending_peers = param->num_peers;
@@ -2464,13 +2464,14 @@ send_peer_chan_width_switch_cmd_tlv(wmi_unified_t wmi_handle,
 	WMI_LOGD("Setting peer limit as %u", max_peers_per_command);
 
 	while (pending_peers > 0) {
+		len = sizeof(*cmd) + WMI_TLV_HDR_SIZE;
 		if (pending_peers >= max_peers_per_command) {
 			len += (max_peers_per_command * sizeof(*cmd_peer_list));
 		} else {
 			len += (pending_peers * sizeof(*cmd_peer_list));
 		}
 
-                buf = wmi_buf_alloc(wmi_handle, len);
+		buf = wmi_buf_alloc(wmi_handle, len);
 		if (!buf) {
 			WMI_LOGE("wmi_buf_alloc failed");
 			return QDF_STATUS_E_FAILURE;

+ 3 - 2
wmi/src/wmi_unified_non_tlv.c

@@ -1092,7 +1092,7 @@ send_peer_chan_width_switch_cmd_non_tlv(wmi_unified_t wmi_handle,
 {
 	wmi_buf_t buf;
 	wmi_peer_chan_width_switch_cmd *cmd;
-	int len = sizeof(*cmd);
+	int len;
 	int max_peers_per_command;
 	struct chan_width_peer_list *cmd_peer_list;
 	int pending_peers = param->num_peers;
@@ -1104,13 +1104,14 @@ send_peer_chan_width_switch_cmd_non_tlv(wmi_unified_t wmi_handle,
 				 sizeof(*cmd)) / sizeof(*cmd_peer_list);
 
 	while (pending_peers > 0) {
+		len = sizeof(*cmd);
 		if (pending_peers >= max_peers_per_command) {
 			len += (max_peers_per_command * sizeof(*cmd_peer_list));
 		} else {
 			len += (pending_peers * sizeof(*cmd_peer_list));
 		}
 
-                buf = wmi_buf_alloc(wmi_handle, len);
+		buf = wmi_buf_alloc(wmi_handle, len);
 		if (!buf) {
 			WMI_LOGE("wmi_buf_alloc failed");
 			return QDF_STATUS_E_FAILURE;