diff options
author | Emmanuel Grumbach | 2012-12-31 13:46:42 +0200 |
---|---|---|
committer | Johannes Berg | 2013-01-03 15:34:11 +0100 |
commit | abae2386d55aff1d395cdb665f03684c227a6a69 (patch) | |
tree | dfa4d78c306f6a17d7c6b170531b760c17055af4 /drivers/net/wireless/iwlwifi/iwl-io.c | |
parent | c8f9b0feab564e1ecf460b440e838673aced282c (diff) |
iwlwifi: always check that grab_nic_access succeeds
This allows to let sparse check that the NIC access is
always released.
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-io.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-io.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-io.c b/drivers/net/wireless/iwlwifi/iwl-io.c index 2bd84adbb5ae..bff3ac96c00b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-io.c +++ b/drivers/net/wireless/iwlwifi/iwl-io.c @@ -101,13 +101,14 @@ EXPORT_SYMBOL_GPL(iwl_poll_bit); u32 iwl_read_direct32(struct iwl_trans *trans, u32 reg) { - u32 value; + u32 value = 0x5a5a5a5a; unsigned long flags; spin_lock_irqsave(&trans->reg_lock, flags); - iwl_trans_grab_nic_access(trans, false); - value = iwl_read32(trans, reg); - iwl_trans_release_nic_access(trans); + if (iwl_trans_grab_nic_access(trans, false)) { + value = iwl_read32(trans, reg); + iwl_trans_release_nic_access(trans); + } spin_unlock_irqrestore(&trans->reg_lock, flags); return value; @@ -119,7 +120,7 @@ void iwl_write_direct32(struct iwl_trans *trans, u32 reg, u32 value) unsigned long flags; spin_lock_irqsave(&trans->reg_lock, flags); - if (likely(iwl_trans_grab_nic_access(trans, false))) { + if (iwl_trans_grab_nic_access(trans, false)) { iwl_write32(trans, reg, value); iwl_trans_release_nic_access(trans); } @@ -159,12 +160,13 @@ static inline void __iwl_write_prph(struct iwl_trans *trans, u32 ofs, u32 val) u32 iwl_read_prph(struct iwl_trans *trans, u32 ofs) { unsigned long flags; - u32 val; + u32 val = 0x5a5a5a5a; spin_lock_irqsave(&trans->reg_lock, flags); - iwl_trans_grab_nic_access(trans, false); - val = __iwl_read_prph(trans, ofs); - iwl_trans_release_nic_access(trans); + if (iwl_trans_grab_nic_access(trans, false)) { + val = __iwl_read_prph(trans, ofs); + iwl_trans_release_nic_access(trans); + } spin_unlock_irqrestore(&trans->reg_lock, flags); return val; } @@ -175,7 +177,7 @@ void iwl_write_prph(struct iwl_trans *trans, u32 ofs, u32 val) unsigned long flags; spin_lock_irqsave(&trans->reg_lock, flags); - if (likely(iwl_trans_grab_nic_access(trans, false))) { + if (iwl_trans_grab_nic_access(trans, false)) { __iwl_write_prph(trans, ofs, val); iwl_trans_release_nic_access(trans); } @@ -188,7 +190,7 @@ void iwl_set_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask) unsigned long flags; spin_lock_irqsave(&trans->reg_lock, flags); - if (likely(iwl_trans_grab_nic_access(trans, false))) { + if (iwl_trans_grab_nic_access(trans, false)) { __iwl_write_prph(trans, ofs, __iwl_read_prph(trans, ofs) | mask); iwl_trans_release_nic_access(trans); @@ -203,7 +205,7 @@ void iwl_set_bits_mask_prph(struct iwl_trans *trans, u32 ofs, unsigned long flags; spin_lock_irqsave(&trans->reg_lock, flags); - if (likely(iwl_trans_grab_nic_access(trans, false))) { + if (iwl_trans_grab_nic_access(trans, false)) { __iwl_write_prph(trans, ofs, (__iwl_read_prph(trans, ofs) & mask) | bits); iwl_trans_release_nic_access(trans); @@ -218,7 +220,7 @@ void iwl_clear_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask) u32 val; spin_lock_irqsave(&trans->reg_lock, flags); - if (likely(iwl_trans_grab_nic_access(trans, false))) { + if (iwl_trans_grab_nic_access(trans, false)) { val = __iwl_read_prph(trans, ofs); __iwl_write_prph(trans, ofs, (val & ~mask)); iwl_trans_release_nic_access(trans); |