]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
iwlwifi: warn if firmware image doesn't exist
authorJohannes Berg <johannes.berg@intel.com>
Fri, 25 Oct 2013 10:32:51 +0000 (12:32 +0200)
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Tue, 29 Oct 2013 13:53:50 +0000 (14:53 +0100)
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>
drivers/net/wireless/iwlwifi/dvm/ucode.c
drivers/net/wireless/iwlwifi/mvm/fw.c

index 86270b69cd024c3e9fe88f6361b15acc1f77eb39..63637949a146d65246f9d2da0381ec8697e6e4a9 100644 (file)
@@ -330,15 +330,14 @@ int iwl_load_ucode_wait_alive(struct iwl_priv *priv,
        enum iwl_ucode_type old_type;
        static const u8 alive_cmd[] = { REPLY_ALIVE };
 
-       old_type = priv->cur_ucode;
-       priv->cur_ucode = ucode_type;
        fw = iwl_get_ucode_image(priv, ucode_type);
+       if (WARN_ON(!fw))
+               return -EINVAL;
 
+       old_type = priv->cur_ucode;
+       priv->cur_ucode = ucode_type;
        priv->ucode_loaded = false;
 
-       if (!fw)
-               return -EINVAL;
-
        iwl_init_notification_wait(&priv->notif_wait, &alive_wait,
                                   alive_cmd, ARRAY_SIZE(alive_cmd),
                                   iwl_alive_fn, &alive_data);
index 83fc5ca04433f36b4009404465f8646cafba9cb0..70e5297646b29b9d2410699b53b5daa7ed3fab3a 100644 (file)
@@ -151,13 +151,11 @@ static int iwl_mvm_load_ucode_wait_alive(struct iwl_mvm *mvm,
        enum iwl_ucode_type old_type = mvm->cur_ucode;
        static const u8 alive_cmd[] = { MVM_ALIVE };
 
-       mvm->cur_ucode = ucode_type;
        fw = iwl_get_ucode_image(mvm, ucode_type);
-
-       mvm->ucode_loaded = false;
-
-       if (!fw)
+       if (WARN_ON(!fw))
                return -EINVAL;
+       mvm->cur_ucode = ucode_type;
+       mvm->ucode_loaded = false;
 
        iwl_init_notification_wait(&mvm->notif_wait, &alive_wait,
                                   alive_cmd, ARRAY_SIZE(alive_cmd),