iwlwifi: dbg: set debug descriptor to NULL outside of iwl_fw_free_dump_desc
authorShahar S Matityahu <shahar.s.matityahu@intel.com>
Fri, 24 Apr 2020 16:46:57 +0000 (19:46 +0300)
committerLuca Coelho <luciano.coelho@intel.com>
Fri, 8 May 2020 06:51:35 +0000 (09:51 +0300)
To avoid static analysis warning and to make the flow more readable, set
the debug descriptor to NULL outside iwl_fw_free_dump_desc and only in
the required places.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20200424194456.5d5c50750a52.I17e33fc268c2097b7c42877f86cef2aa163b913a@changeid
drivers/net/wireless/intel/iwlwifi/fw/dbg.c

index 37c8b6cc2ec77db7d33a88dba1f426ca9a95e2ac..4df10f3d99d2d9734bec3df54d7930de48dbd5ca 100644 (file)
@@ -2198,12 +2198,11 @@ static u32 iwl_dump_ini_file_gen(struct iwl_fw_runtime *fwrt,
 }
 
 static inline void iwl_fw_free_dump_desc(struct iwl_fw_runtime *fwrt,
-                                        const struct iwl_fw_dump_desc **desc)
+                                        const struct iwl_fw_dump_desc *desc)
 {
-       if (desc && *desc != &iwl_dump_desc_assert)
-               kfree(*desc);
+       if (desc && desc != &iwl_dump_desc_assert)
+               kfree(desc);
 
-       *desc = NULL;
        fwrt->dump.lmac_err_id[0] = 0;
        if (fwrt->smem_cfg.num_lmacs > 1)
                fwrt->dump.lmac_err_id[1] = 0;
@@ -2315,7 +2314,7 @@ int iwl_fw_dbg_collect_desc(struct iwl_fw_runtime *fwrt,
        unsigned long idx;
 
        if (iwl_trans_dbg_ini_valid(fwrt->trans)) {
-               iwl_fw_free_dump_desc(fwrt, &desc);
+               iwl_fw_free_dump_desc(fwrt, desc);
                return 0;
        }
 
@@ -2336,7 +2335,7 @@ int iwl_fw_dbg_collect_desc(struct iwl_fw_runtime *fwrt,
        wk_data = &fwrt->dump.wks[idx];
 
        if (WARN_ON(wk_data->dump_data.desc))
-               iwl_fw_free_dump_desc(fwrt, &wk_data->dump_data.desc);
+               iwl_fw_free_dump_desc(fwrt, wk_data->dump_data.desc);
 
        wk_data->dump_data.desc = desc;
        wk_data->dump_data.monitor_only = monitor_only;
@@ -2593,10 +2592,12 @@ static void iwl_fw_dbg_collect_sync(struct iwl_fw_runtime *fwrt, u8 wk_idx)
        iwl_fw_dbg_stop_restart_recording(fwrt, &params, false);
 
 out:
-       if (iwl_trans_dbg_ini_valid(fwrt->trans))
+       if (iwl_trans_dbg_ini_valid(fwrt->trans)) {
                iwl_fw_error_dump_data_free(dump_data);
-       else
-               iwl_fw_free_dump_desc(fwrt, &dump_data->desc);
+       } else {
+               iwl_fw_free_dump_desc(fwrt, dump_data->desc);
+               dump_data->desc = NULL;
+       }
 
        clear_bit(wk_idx, &fwrt->dump.active_wks);
 }