Commit e5d15cb5 authored by Eliad Peller's avatar Eliad Peller Committed by Emmanuel Grumbach

iwlwifi: bail out in case of bad trans state

In case of bad trans state (i.e. fw is not loaded) bail
out immediately instead of calling the trans, which might
not be fully initialized yet.

Also add WARN_ON_ONCE to help debugging where the errorneous
call is coming from.
Signed-off-by: default avatarEliad Peller <eliadx.peller@intel.com>
Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
parent 5d4e8d64
...@@ -1001,8 +1001,10 @@ static inline int iwl_trans_tx(struct iwl_trans *trans, struct sk_buff *skb, ...@@ -1001,8 +1001,10 @@ static inline int iwl_trans_tx(struct iwl_trans *trans, struct sk_buff *skb,
if (unlikely(test_bit(STATUS_FW_ERROR, &trans->status))) if (unlikely(test_bit(STATUS_FW_ERROR, &trans->status)))
return -EIO; return -EIO;
if (unlikely(trans->state != IWL_TRANS_FW_ALIVE)) if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) {
IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state);
return -EIO;
}
return trans->ops->tx(trans, skb, dev_cmd, queue); return trans->ops->tx(trans, skb, dev_cmd, queue);
} }
...@@ -1010,8 +1012,10 @@ static inline int iwl_trans_tx(struct iwl_trans *trans, struct sk_buff *skb, ...@@ -1010,8 +1012,10 @@ static inline int iwl_trans_tx(struct iwl_trans *trans, struct sk_buff *skb,
static inline void iwl_trans_reclaim(struct iwl_trans *trans, int queue, static inline void iwl_trans_reclaim(struct iwl_trans *trans, int queue,
int ssn, struct sk_buff_head *skbs) int ssn, struct sk_buff_head *skbs)
{ {
if (unlikely(trans->state != IWL_TRANS_FW_ALIVE)) if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) {
IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state);
return;
}
trans->ops->reclaim(trans, queue, ssn, skbs); trans->ops->reclaim(trans, queue, ssn, skbs);
} }
...@@ -1029,8 +1033,10 @@ iwl_trans_txq_enable_cfg(struct iwl_trans *trans, int queue, u16 ssn, ...@@ -1029,8 +1033,10 @@ iwl_trans_txq_enable_cfg(struct iwl_trans *trans, int queue, u16 ssn,
{ {
might_sleep(); might_sleep();
if (unlikely((trans->state != IWL_TRANS_FW_ALIVE))) if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) {
IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state);
return;
}
trans->ops->txq_enable(trans, queue, ssn, cfg, queue_wdg_timeout); trans->ops->txq_enable(trans, queue, ssn, cfg, queue_wdg_timeout);
} }
...@@ -1070,8 +1076,10 @@ static inline void iwl_trans_freeze_txq_timer(struct iwl_trans *trans, ...@@ -1070,8 +1076,10 @@ static inline void iwl_trans_freeze_txq_timer(struct iwl_trans *trans,
unsigned long txqs, unsigned long txqs,
bool freeze) bool freeze)
{ {
if (unlikely(trans->state != IWL_TRANS_FW_ALIVE)) if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) {
IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state);
return;
}
if (trans->ops->freeze_txq_timer) if (trans->ops->freeze_txq_timer)
trans->ops->freeze_txq_timer(trans, txqs, freeze); trans->ops->freeze_txq_timer(trans, txqs, freeze);
...@@ -1080,8 +1088,10 @@ static inline void iwl_trans_freeze_txq_timer(struct iwl_trans *trans, ...@@ -1080,8 +1088,10 @@ static inline void iwl_trans_freeze_txq_timer(struct iwl_trans *trans,
static inline void iwl_trans_block_txq_ptrs(struct iwl_trans *trans, static inline void iwl_trans_block_txq_ptrs(struct iwl_trans *trans,
bool block) bool block)
{ {
if (unlikely(trans->state != IWL_TRANS_FW_ALIVE)) if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) {
IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state);
return;
}
if (trans->ops->block_txq_ptrs) if (trans->ops->block_txq_ptrs)
trans->ops->block_txq_ptrs(trans, block); trans->ops->block_txq_ptrs(trans, block);
...@@ -1090,8 +1100,10 @@ static inline void iwl_trans_block_txq_ptrs(struct iwl_trans *trans, ...@@ -1090,8 +1100,10 @@ static inline void iwl_trans_block_txq_ptrs(struct iwl_trans *trans,
static inline int iwl_trans_wait_tx_queue_empty(struct iwl_trans *trans, static inline int iwl_trans_wait_tx_queue_empty(struct iwl_trans *trans,
u32 txqs) u32 txqs)
{ {
if (unlikely(trans->state != IWL_TRANS_FW_ALIVE)) if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) {
IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state);
return -EIO;
}
return trans->ops->wait_tx_queue_empty(trans, txqs); return trans->ops->wait_tx_queue_empty(trans, txqs);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment