iwlwifi: yoyo: Avoid using dram data if allocation failed
authorMukesh Sisodiya <mukesh.sisodiya@intel.com>
Fri, 4 Feb 2022 10:25:01 +0000 (12:25 +0200)
committerLuca Coelho <luciano.coelho@intel.com>
Fri, 18 Feb 2022 08:40:52 +0000 (10:40 +0200)
The config set TLV setting depend on dram allocation
and if allocation failed the data used in config set tlv
should not set this.
Adding the check if dram fragment is available or not.

Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Fixes: 1a5daead217c ("iwlwifi: yoyo: support for ROM usniffer")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220204122220.44835d181528.I3e78ba29c13bbeada017fcb2a620f3552c1dfa30@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c

index 1e884dc..0cda8ac 100644 (file)
@@ -875,11 +875,18 @@ static void iwl_dbg_tlv_apply_config(struct iwl_fw_runtime *fwrt,
                case IWL_FW_INI_CONFIG_SET_TYPE_DBGC_DRAM_ADDR: {
                        struct iwl_dbgc1_info dram_info = {};
                        struct iwl_dram_data *frags = &fwrt->trans->dbg.fw_mon_ini[1].frags[0];
-                       __le64 dram_base_addr = cpu_to_le64(frags->physical);
-                       __le32 dram_size = cpu_to_le32(frags->size);
-                       u64  dram_addr = le64_to_cpu(dram_base_addr);
+                       __le64 dram_base_addr;
+                       __le32 dram_size;
+                       u64 dram_addr;
                        u32 ret;
 
+                       if (!frags)
+                               break;
+
+                       dram_base_addr = cpu_to_le64(frags->physical);
+                       dram_size = cpu_to_le32(frags->size);
+                       dram_addr = le64_to_cpu(dram_base_addr);
+
                        IWL_DEBUG_FW(fwrt, "WRT: dram_base_addr 0x%016llx, dram_size 0x%x\n",
                                     dram_base_addr, dram_size);
                        IWL_DEBUG_FW(fwrt, "WRT: config_list->addr_offset: %u\n",