aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2013-10-25 06:32:51 -0400
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>2013-10-29 09:53:50 -0400
commitbefe9b6fd897e1bfce224b662ce62dd751843c34 (patch)
treefd7d5901b2d5c92a427d0bbfc6ae234f9dcd508d
parentcbb346f2fc61acf62f97e3dd4da230b12f1cafaf (diff)
iwlwifi: warn if firmware image doesn't exist
If the firmware image that we attempt to load doesn't actually exist we have a broken firmware file or other code not checking things correctly, so warn in such a case. Also avoid assigning cur_ucode/ucode_loaded then. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/ucode.c9
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/fw.c8
2 files changed, 7 insertions, 10 deletions
diff --git a/drivers/net/wireless/iwlwifi/dvm/ucode.c b/drivers/net/wireless/iwlwifi/dvm/ucode.c
index 86270b69cd02..63637949a146 100644
--- a/drivers/net/wireless/iwlwifi/dvm/ucode.c
+++ b/drivers/net/wireless/iwlwifi/dvm/ucode.c
@@ -330,15 +330,14 @@ int iwl_load_ucode_wait_alive(struct iwl_priv *priv,
330 enum iwl_ucode_type old_type; 330 enum iwl_ucode_type old_type;
331 static const u8 alive_cmd[] = { REPLY_ALIVE }; 331 static const u8 alive_cmd[] = { REPLY_ALIVE };
332 332
333 old_type = priv->cur_ucode;
334 priv->cur_ucode = ucode_type;
335 fw = iwl_get_ucode_image(priv, ucode_type); 333 fw = iwl_get_ucode_image(priv, ucode_type);
334 if (WARN_ON(!fw))
335 return -EINVAL;
336 336
337 old_type = priv->cur_ucode;
338 priv->cur_ucode = ucode_type;
337 priv->ucode_loaded = false; 339 priv->ucode_loaded = false;
338 340
339 if (!fw)
340 return -EINVAL;
341
342 iwl_init_notification_wait(&priv->notif_wait, &alive_wait, 341 iwl_init_notification_wait(&priv->notif_wait, &alive_wait,
343 alive_cmd, ARRAY_SIZE(alive_cmd), 342 alive_cmd, ARRAY_SIZE(alive_cmd),
344 iwl_alive_fn, &alive_data); 343 iwl_alive_fn, &alive_data);
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw.c b/drivers/net/wireless/iwlwifi/mvm/fw.c
index 83fc5ca04433..70e5297646b2 100644
--- a/drivers/net/wireless/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/iwlwifi/mvm/fw.c
@@ -151,13 +151,11 @@ static int iwl_mvm_load_ucode_wait_alive(struct iwl_mvm *mvm,
151 enum iwl_ucode_type old_type = mvm->cur_ucode; 151 enum iwl_ucode_type old_type = mvm->cur_ucode;
152 static const u8 alive_cmd[] = { MVM_ALIVE }; 152 static const u8 alive_cmd[] = { MVM_ALIVE };
153 153
154 mvm->cur_ucode = ucode_type;
155 fw = iwl_get_ucode_image(mvm, ucode_type); 154 fw = iwl_get_ucode_image(mvm, ucode_type);
156 155 if (WARN_ON(!fw))
157 mvm->ucode_loaded = false;
158
159 if (!fw)
160 return -EINVAL; 156 return -EINVAL;
157 mvm->cur_ucode = ucode_type;
158 mvm->ucode_loaded = false;
161 159
162 iwl_init_notification_wait(&mvm->notif_wait, &alive_wait, 160 iwl_init_notification_wait(&mvm->notif_wait, &alive_wait,
163 alive_cmd, ARRAY_SIZE(alive_cmd), 161 alive_cmd, ARRAY_SIZE(alive_cmd),