[2/2,SRU,OEM-OSP1] iwlwifi: mvm: don't use iwl_geo_tx_power_profiles_cmd_v1
diff mbox series

Message ID 20190627062829.1988-3-vicamo.yang@canonical.com
State New
Headers show
Series
  • iwlwifi: fix FW error in SYNC CMD GEO_TX_POWER_LIMIT
Related show

Commit Message

You-Sheng Yang June 27, 2019, 6:28 a.m. UTC
From: Luca Coelho <luciano.coelho@intel.com>

BugLink: https://bugs.launchpad.net/bugs/1834415

We don't need to allocate a new structure and copy the data from the
new one into it, because they are the same, except that the new
version has one more element at the end.  We can simply send the same
structure but pass the size of the old one when we send the command.

This avoid extra stack allocations and a memcpy in the code.  The
memcpy() was causing a static analyzer warning because it was not
using the size of the destination.

type=bugfix
ticket=none
fixes=I52d2afa9f243765b63da3279496c524c77b26e20

Change-Id: Iaaeba37a842ba6abc9e53c7f018f5362964a6daf
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Reviewed-on: https://git-amr-3.devtools.intel.com/gerrit/222716
Tested-by: ec ger unix iil jenkins <EC.GER.UNIX.IIL.JENKINS@INTEL.COM>
x-iwlwifi-stack-dev: 023605ffda133e4cea2fe29c2ec7dbcbe48988c4
(backported from commit 33693c2f3ae9eafcfd69d2c2977dcc8cbaf199fc
https://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/backport-iwlwifi.git)
Signed-off-by: You-Sheng Yang <vicamo.yang@canonical.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

Patch
diff mbox series

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
index f66fe897d415f..80bb2f50a730f 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
@@ -959,21 +959,16 @@  static int iwl_mvm_sar_geo_init(struct iwl_mvm *mvm)
 					i, j, value[1], value[2], value[0]);
 		}
 	}
-	if (fw_has_api(&mvm->fw->ucode_capa,
-		       IWL_UCODE_TLV_API_SAR_TABLE_VER)) {
-		cmd.table_revision = cpu_to_le32(mvm->geo_rev);
-	} else {
-		struct iwl_geo_tx_power_profiles_cmd_v1 cmd_v1 = {
-			.ops = cpu_to_le32(IWL_PER_CHAIN_OFFSET_SET_TABLES),
-		};
 
-		memcpy(&cmd_v1.table, cmd.table,
-		       sizeof(struct iwl_per_chain_offset_group) *
-		       IWL_NUM_GEO_PROFILES);
+	cmd.table_revision = cpu_to_le32(mvm->geo_rev);
 
-		return iwl_mvm_send_cmd_pdu(mvm, cmd_wide_id, 0, sizeof(cmd_v1),
-					    &cmd_v1);
+	if (!fw_has_api(&mvm->fw->ucode_capa,
+		       IWL_UCODE_TLV_API_SAR_TABLE_VER)) {
+		return iwl_mvm_send_cmd_pdu(mvm, cmd_wide_id, 0,
+				sizeof(struct iwl_geo_tx_power_profiles_cmd_v1),
+				&cmd);
 	}
+
 	return iwl_mvm_send_cmd_pdu(mvm, cmd_wide_id, 0, sizeof(cmd), &cmd);
 }