Skip to content

Commit 0ec971f

Browse files
jmberg-intellucacoelho
authored andcommitted
iwlwifi: remove resp_pkt NULL checks
Contrary to what some of the comments say, if rfkill was asserted the transport will return -ERFKILL instead of success, if CMD_WANT_SKB was set, so it's not necessary to check cmd.resp_pkt for being NULL if the return code was success. Validate that this is true in iwl_trans_send_cmd(). Most of the other code modifications were done with the following spatch: @@ struct iwl_host_cmd cmd; identifier pkt; @@ <... ( pkt = cmd.resp_pkt; ... -if (!pkt) { ... } | pkt = cmd.resp_pkt; ... -if (WARN_ON(!pkt)) { ... } | -if (!cmd.resp_pkt) { ... } ) ...> Signed-off-by: Johannes Berg <[email protected]> Signed-off-by: Luca Coelho <[email protected]>
1 parent 664e968 commit 0ec971f

File tree

5 files changed

+3
-24
lines changed

5 files changed

+3
-24
lines changed

drivers/net/wireless/intel/iwlwifi/iwl-trans.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ int iwl_trans_send_cmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
143143
if (!(cmd->flags & CMD_ASYNC))
144144
lock_map_release(&trans->sync_cmd_lockdep_map);
145145

146+
if (WARN_ON((cmd->flags & CMD_WANT_SKB) && !ret && !cmd->resp_pkt))
147+
return -EIO;
148+
146149
return ret;
147150
}
148151
IWL_EXPORT_SYMBOL(iwl_trans_send_cmd);

drivers/net/wireless/intel/iwlwifi/mvm/d3.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1795,12 +1795,6 @@ iwl_mvm_get_wakeup_status(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
17951795
return ERR_PTR(ret);
17961796
}
17971797

1798-
/* RF-kill already asserted again... */
1799-
if (!cmd.resp_pkt) {
1800-
fw_status = ERR_PTR(-ERFKILL);
1801-
goto out_free_resp;
1802-
}
1803-
18041798
status_size = sizeof(*fw_status);
18051799

18061800
len = iwl_rx_packet_payload_len(cmd.resp_pkt);
@@ -1925,12 +1919,6 @@ iwl_mvm_netdetect_query_results(struct iwl_mvm *mvm,
19251919
return ret;
19261920
}
19271921

1928-
/* RF-kill already asserted again... */
1929-
if (!cmd.resp_pkt) {
1930-
ret = -ERFKILL;
1931-
goto out_free_resp;
1932-
}
1933-
19341922
len = iwl_rx_packet_payload_len(cmd.resp_pkt);
19351923
if (len < sizeof(*query)) {
19361924
IWL_ERR(mvm, "Invalid scan offload profiles query response!\n");

drivers/net/wireless/intel/iwlwifi/mvm/nvm.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,6 @@ static int iwl_nvm_write_chunk(struct iwl_mvm *mvm, u16 section,
118118
return ret;
119119

120120
pkt = cmd.resp_pkt;
121-
if (!pkt) {
122-
IWL_ERR(mvm, "Error in NVM_ACCESS response\n");
123-
return -EINVAL;
124-
}
125121
/* Extract & check NVM write response */
126122
nvm_resp = (void *)pkt->data;
127123
if (le16_to_cpu(nvm_resp->status) != READ_NVM_CHUNK_SUCCEED) {

drivers/net/wireless/intel/iwlwifi/mvm/ops.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1611,9 +1611,6 @@ static void iwl_mvm_d0i3_exit_work(struct work_struct *wk)
16111611
if (ret)
16121612
goto out;
16131613

1614-
if (!get_status_cmd.resp_pkt)
1615-
goto out;
1616-
16171614
status = (void *)get_status_cmd.resp_pkt->data;
16181615
wakeup_reasons = le32_to_cpu(status->wakeup_reasons);
16191616
qos_seq = status->qos_seq_ctr;

drivers/net/wireless/intel/iwlwifi/mvm/utils.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,6 @@ int iwl_mvm_send_cmd_status(struct iwl_mvm *mvm, struct iwl_host_cmd *cmd,
168168
}
169169

170170
pkt = cmd->resp_pkt;
171-
/* Can happen if RFKILL is asserted */
172-
if (!pkt) {
173-
ret = 0;
174-
goto out_free_resp;
175-
}
176171

177172
resp_len = iwl_rx_packet_payload_len(pkt);
178173
if (WARN_ON_ONCE(resp_len != sizeof(*resp))) {

0 commit comments

Comments
 (0)