From patchwork Wed Feb 10 15:15:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Coelho X-Patchwork-Id: 380631 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 603A0C43331 for ; Wed, 10 Feb 2021 15:16:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 32F7564E38 for ; Wed, 10 Feb 2021 15:16:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231865AbhBJPQR (ORCPT ); Wed, 10 Feb 2021 10:16:17 -0500 Received: from paleale.coelho.fi ([176.9.41.70]:45274 "EHLO farmhouse.coelho.fi" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231695AbhBJPQK (ORCPT ); Wed, 10 Feb 2021 10:16:10 -0500 Received: from 91-156-6-193.elisa-laajakaista.fi ([91.156.6.193] helo=redipa.ger.corp.intel.com) by farmhouse.coelho.fi with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1l9rD7-0049kS-1f; Wed, 10 Feb 2021 17:15:21 +0200 From: Luca Coelho To: kvalo@codeaurora.org Cc: linux-wireless@vger.kernel.org Date: Wed, 10 Feb 2021 17:15:10 +0200 Message-Id: X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210210151514.416221-1-luca@coelho.fi> References: <20210210151514.416221-1-luca@coelho.fi> MIME-Version: 1.0 Subject: [PATCH 08/12] iwlwifi: mvm: Check ret code for iwl_mvm_load_nvm_to_nic Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Abhishek Naik Return value of the iwl_mvm_load_nvm_to_nic func is not analyzed. If load NVM to nic func fails and NVM is not loaded to fw properly, then fw may behave badly and lead to some strange issue. This commit will analyze return value and if load NVM to nic has failed, then the error code is sent to the previous func, which will trigger WRT log collection. iwl_fw_dbg_error_collect() func collects dump only if tri type is FW_DBG_TRIGGER_ALIVE_TIMEOUT. But when Load NVM to nic function fails trig_type is FW_DBG_TRIGGER_DRIVER. This commit also has code changes to collect dump when trig_type is FW_DBG_TRIGGER_DRIVER. Signed-off-by: Abhishek Naik Signed-off-by: Luca Coelho --- drivers/net/wireless/intel/iwlwifi/fw/dbg.c | 3 ++- drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 17 ++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c index 811480eac5fa..504729663c35 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c +++ b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c @@ -2447,7 +2447,8 @@ int iwl_fw_dbg_error_collect(struct iwl_fw_runtime *fwrt, return -EIO; if (iwl_trans_dbg_ini_valid(fwrt->trans)) { - if (trig_type != FW_DBG_TRIGGER_ALIVE_TIMEOUT) + if (trig_type != FW_DBG_TRIGGER_ALIVE_TIMEOUT && + trig_type != FW_DBG_TRIGGER_DRIVER) return -EIO; iwl_dbg_tlv_time_point(fwrt, diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c index 4d5def7e2d8c..15e2773ce7e7 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c @@ -476,9 +476,13 @@ static int iwl_run_unified_mvm_ucode(struct iwl_mvm *mvm) /* Load NVM to NIC if needed */ if (mvm->nvm_file_name) { - iwl_read_external_nvm(mvm->trans, mvm->nvm_file_name, - mvm->nvm_sections); - iwl_mvm_load_nvm_to_nic(mvm); + ret = iwl_read_external_nvm(mvm->trans, mvm->nvm_file_name, + mvm->nvm_sections); + if (ret) + goto error; + ret = iwl_mvm_load_nvm_to_nic(mvm); + if (ret) + goto error; } if (IWL_MVM_PARSE_NVM && !mvm->nvm_data) { @@ -659,8 +663,11 @@ int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm) } /* In case we read the NVM from external file, load it to the NIC */ - if (mvm->nvm_file_name) - iwl_mvm_load_nvm_to_nic(mvm); + if (mvm->nvm_file_name) { + ret = iwl_mvm_load_nvm_to_nic(mvm); + if (ret) + goto remove_notif; + } WARN_ONCE(mvm->nvm_data->nvm_version < mvm->trans->cfg->nvm_ver, "Too old NVM version (0x%0x, required = 0x%0x)",