summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
diff options
context:
space:
mode:
authorStanislaw Gruszka <sgruszka@redhat.com>2012-03-07 09:52:24 -0800
committerJohn W. Linville <linville@tuxdriver.com>2012-03-08 13:59:50 -0500
commitbfe4b80e9f7385f34986736cdc094be56782109a (patch)
tree29b1335d3045834bcbb5d23d53a4b212ef9355e0 /drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
parentaa5affbacb24cb5d8fd6f7c66e57d62164ed6d34 (diff)
downloadblackbird-op-linux-bfe4b80e9f7385f34986736cdc094be56782109a.tar.gz
blackbird-op-linux-bfe4b80e9f7385f34986736cdc094be56782109a.zip
iwlwifi: always check if got h/w access before write
Before we write to the device registers always check if iwl_grap_nic_access() was successful. On the way change return type of grab_nic_access() to bool, and add likely()/unlikely() statement. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
index 83cc60e8f607..5d1fc7b1b0a3 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
@@ -745,7 +745,8 @@ static int iwl_print_event_log(struct iwl_trans *trans, u32 start_idx,
/* Make sure device is powered up for SRAM reads */
spin_lock_irqsave(&trans->reg_lock, reg_flags);
- iwl_grab_nic_access(trans);
+ if (unlikely(!iwl_grab_nic_access(trans)))
+ goto out_unlock;
/* Set starting address; reads will auto-increment */
iwl_write32(trans, HBUS_TARG_MEM_RADDR, ptr);
@@ -785,6 +786,7 @@ static int iwl_print_event_log(struct iwl_trans *trans, u32 start_idx,
/* Allow device to power down */
iwl_release_nic_access(trans);
+out_unlock:
spin_unlock_irqrestore(&trans->reg_lock, reg_flags);
return pos;
}
OpenPOWER on IntegriCloud