summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Mork <bjorn@mork.no>2015-10-26 14:46:56 +0100
committerBjørn Mork <bjorn@mork.no>2015-10-26 14:46:56 +0100
commitd310aecfcc9545ba0abbfb5e2638497ae924b34d (patch)
tree0b3365bc7f4cf65fd68cf876ee4d794182b77c9e
parente821b5070cc38e642b3a0daa88d133ec0cb63493 (diff)
mwlwifi: avoid downloading firmware to non-responding device
Signed-off-by: Bjørn Mork <bjorn@mork.no>
-rw-r--r--fwcmd.c11
-rw-r--r--fwcmd.h2
-rw-r--r--fwdl.c5
3 files changed, 12 insertions, 6 deletions
diff --git a/fwcmd.c b/fwcmd.c
index 62ed88a..42eee94 100644
--- a/fwcmd.c
+++ b/fwcmd.c
@@ -661,13 +661,16 @@ static int mwl_fwcmd_encryption_set_cmd_info(struct hostcmd_cmd_set_key *cmd,
return 0;
}
-void mwl_fwcmd_reset(struct ieee80211_hw *hw)
+int mwl_fwcmd_reset(struct ieee80211_hw *hw)
{
struct mwl_priv *priv = hw->priv;
- if (mwl_fwcmd_chk_adapter(priv))
- writel(ISR_RESET,
- priv->iobase1 + MACREG_REG_H2A_INTERRUPT_EVENTS);
+ if (!mwl_fwcmd_chk_adapter(priv))
+ return -ENODEV;
+
+ writel(ISR_RESET,
+ priv->iobase1 + MACREG_REG_H2A_INTERRUPT_EVENTS);
+ return 0;
}
void mwl_fwcmd_int_enable(struct ieee80211_hw *hw)
diff --git a/fwcmd.h b/fwcmd.h
index 6775c98..3abd493 100644
--- a/fwcmd.h
+++ b/fwcmd.h
@@ -55,7 +55,7 @@ enum encr_type {
ENCR_TYPE_MIX = 7,
};
-void mwl_fwcmd_reset(struct ieee80211_hw *hw);
+int mwl_fwcmd_reset(struct ieee80211_hw *hw);
void mwl_fwcmd_int_enable(struct ieee80211_hw *hw);
diff --git a/fwdl.c b/fwdl.c
index 48c8c3e..f775caa 100644
--- a/fwdl.c
+++ b/fwdl.c
@@ -60,7 +60,9 @@ int mwl_fwdl_download_firmware(struct ieee80211_hw *hw)
fw = priv->fw_ucode;
- mwl_fwcmd_reset(hw);
+ /* if reset fails, then dl will most likely hang */
+ if (mwl_fwcmd_reset(hw) < 0)
+ goto err_reset;
/* FW before jumping to boot rom, it will enable PCIe transaction retry,
* wait for boot code to stop it.
@@ -178,5 +180,6 @@ err_download:
mwl_fwcmd_reset(hw);
+err_reset:
return -EIO;
}