Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8f7ffbe2 authored by David Spinadel's avatar David Spinadel Committed by John W. Linville
Browse files

iwlwifi: avoid some operations if no uCode loaded



Printing the SRAM and similar testmode operations could
be triggered when no uCode is loaded; prevent those
invalid operations by tracking whether uCode is loaded.

Signed-off-by: default avatarDavid Spinadel <david.spinadel@intel.com>
Signed-off-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 69a10b29
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1189,6 +1189,7 @@ int iwlagn_suspend(struct iwl_priv *priv, struct cfg80211_wowlan *wowlan)

	memcpy(&rxon, &ctx->active, sizeof(rxon));

	priv->ucode_loaded = false;
	iwl_trans_stop_device(trans(priv));

	priv->wowlan = true;
+2 −0
Original line number Diff line number Diff line
@@ -816,6 +816,7 @@ void iwl_down(struct iwl_priv *priv)
	if (priv->mac80211_registered)
		ieee80211_stop_queues(priv->hw);

	priv->ucode_loaded = false;
	iwl_trans_stop_device(trans(priv));

	/* Clear out all status bits but a few that are stable across reset */
@@ -1406,6 +1407,7 @@ static void iwl_op_mode_dvm_stop(struct iwl_op_mode *op_mode)
	iwl_tt_exit(priv);

	/*This will stop the queues, move the device to low power state */
	priv->ucode_loaded = false;
	iwl_trans_stop_device(trans(priv));

	iwl_eeprom_free(priv->shrd);
+3 −0
Original line number Diff line number Diff line
@@ -838,6 +838,9 @@ static void iwlagn_fw_error(struct iwl_priv *priv, bool ondemand)
		iwl_print_rx_config_cmd(priv, IWL_RXON_CTX_BSS);
#endif

	/* uCode is no longer loaded. */
	priv->ucode_loaded = false;

	/* Set the FW error flag -- cleared on iwl_down */
	set_bit(STATUS_FW_ERROR, &priv->shrd->status);

+13 −2
Original line number Diff line number Diff line
@@ -235,10 +235,21 @@ static ssize_t iwl_dbgfs_sram_read(struct file *file,
	/* default is to dump the entire data segment */
	if (!priv->dbgfs_sram_offset && !priv->dbgfs_sram_len) {
		priv->dbgfs_sram_offset = 0x800000;
		if (priv->shrd->ucode_type == IWL_UCODE_INIT)
		if (!priv->ucode_loaded) {
			IWL_ERR(priv, "No uCode has been loadded.\n");
			return -EINVAL;
		}
		if (priv->shrd->ucode_type == IWL_UCODE_INIT) {
			priv->dbgfs_sram_len = priv->fw->ucode_init.data.len;
		else
		} else if (priv->shrd->ucode_type == IWL_UCODE_REGULAR) {
			priv->dbgfs_sram_len = priv->fw->ucode_rt.data.len;
		} else if (priv->shrd->ucode_type == IWL_UCODE_WOWLAN) {
			priv->dbgfs_sram_len = priv->fw->ucode_wowlan.data.len;
		} else {
			IWL_ERR(priv, "Unsupported type of uCode loaded?"
					" that shouldn't happen.\n");
			return -EINVAL;
		}
	}
	len = priv->dbgfs_sram_len;

+1 −0
Original line number Diff line number Diff line
@@ -769,6 +769,7 @@ struct iwl_priv {
	/* firmware reload counter and timestamp */
	unsigned long reload_jiffies;
	int reload_count;
	bool ucode_loaded;

	/* we allocate array of iwl_channel_info for NIC's valid channels.
	 *    Access via channel # using indirect index array */
Loading