Commit b6c32171 authored by Zhu Yi's avatar Zhu Yi Committed by John W. Linville

iwmc3200wifi: make iwm_send_wifi_if_cmd return 0 on success

We used to return the result of wait_event_interruptible_timeout()
which is the remaining timeout on success. But this information is
not used by any of its callers. So we just return 0 on success.
This fixed a erroneous return value bug for iwm_set_key().
Signed-off-by: default avatarZhu Yi <yi.zhu@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 0e371f1a
...@@ -87,8 +87,7 @@ int iwm_send_wifi_if_cmd(struct iwm_priv *iwm, void *payload, u16 payload_size, ...@@ -87,8 +87,7 @@ int iwm_send_wifi_if_cmd(struct iwm_priv *iwm, void *payload, u16 payload_size,
test_and_clear_bit(oid, &iwm->wifi_ntfy[0]), test_and_clear_bit(oid, &iwm->wifi_ntfy[0]),
3 * HZ); 3 * HZ);
if (!ret) return ret ? 0 : -EBUSY;
ret = -EBUSY;
} }
return ret; return ret;
...@@ -480,8 +479,10 @@ static int iwm_target_read(struct iwm_priv *iwm, __le32 address, ...@@ -480,8 +479,10 @@ static int iwm_target_read(struct iwm_priv *iwm, __le32 address,
target_cmd.eop = 1; target_cmd.eop = 1;
ret = iwm_hal_send_target_cmd(iwm, &target_cmd, NULL); ret = iwm_hal_send_target_cmd(iwm, &target_cmd, NULL);
if (ret < 0) if (ret < 0) {
IWM_ERR(iwm, "Couldn't send READ command\n"); IWM_ERR(iwm, "Couldn't send READ command\n");
return ret;
}
/* When succeding, the send_target routine returns the seq number */ /* When succeding, the send_target routine returns the seq number */
seq_num = ret; seq_num = ret;
...@@ -501,7 +502,7 @@ static int iwm_target_read(struct iwm_priv *iwm, __le32 address, ...@@ -501,7 +502,7 @@ static int iwm_target_read(struct iwm_priv *iwm, __le32 address,
kfree(cmd); kfree(cmd);
return ret; return 0;
} }
int iwm_read_mac(struct iwm_priv *iwm, u8 *mac) int iwm_read_mac(struct iwm_priv *iwm, u8 *mac)
...@@ -511,7 +512,7 @@ int iwm_read_mac(struct iwm_priv *iwm, u8 *mac) ...@@ -511,7 +512,7 @@ int iwm_read_mac(struct iwm_priv *iwm, u8 *mac)
ret = iwm_target_read(iwm, cpu_to_le32(WICO_MAC_ADDRESS_ADDR), ret = iwm_target_read(iwm, cpu_to_le32(WICO_MAC_ADDRESS_ADDR),
mac_align, sizeof(mac_align)); mac_align, sizeof(mac_align));
if (ret < 0) if (ret)
return ret; return ret;
if (is_valid_ether_addr(mac_align)) if (is_valid_ether_addr(mac_align))
...@@ -714,7 +715,7 @@ int iwm_set_key(struct iwm_priv *iwm, bool remove, struct iwm_key *key) ...@@ -714,7 +715,7 @@ int iwm_set_key(struct iwm_priv *iwm, bool remove, struct iwm_key *key)
ret = iwm_send_wifi_if_cmd(iwm, &key_remove, ret = iwm_send_wifi_if_cmd(iwm, &key_remove,
sizeof(struct iwm_umac_key_remove), sizeof(struct iwm_umac_key_remove),
1); 1);
if (ret < 0) if (ret)
return ret; return ret;
iwm->keys[key_idx].key_len = 0; iwm->keys[key_idx].key_len = 0;
...@@ -736,7 +737,7 @@ int iwm_send_mlme_profile(struct iwm_priv *iwm) ...@@ -736,7 +737,7 @@ int iwm_send_mlme_profile(struct iwm_priv *iwm)
sizeof(struct iwm_umac_wifi_if)); sizeof(struct iwm_umac_wifi_if));
ret = iwm_send_wifi_if_cmd(iwm, &profile, sizeof(profile), 1); ret = iwm_send_wifi_if_cmd(iwm, &profile, sizeof(profile), 1);
if (ret < 0) { if (ret) {
IWM_ERR(iwm, "Send profile command failed\n"); IWM_ERR(iwm, "Send profile command failed\n");
return ret; return ret;
} }
...@@ -752,12 +753,12 @@ int iwm_send_mlme_profile(struct iwm_priv *iwm) ...@@ -752,12 +753,12 @@ int iwm_send_mlme_profile(struct iwm_priv *iwm)
3 * HZ); 3 * HZ);
ret = iwm_set_key(iwm, 0, key); ret = iwm_set_key(iwm, 0, key);
if (ret < 0) if (ret)
return ret; return ret;
if (iwm->default_key == i) { if (iwm->default_key == i) {
ret = iwm_set_tx_key(iwm, i); ret = iwm_set_tx_key(iwm, i);
if (ret < 0) if (ret)
return ret; return ret;
} }
} }
...@@ -778,15 +779,13 @@ int iwm_invalidate_mlme_profile(struct iwm_priv *iwm) ...@@ -778,15 +779,13 @@ int iwm_invalidate_mlme_profile(struct iwm_priv *iwm)
invalid.reason = WLAN_REASON_UNSPECIFIED; invalid.reason = WLAN_REASON_UNSPECIFIED;
ret = iwm_send_wifi_if_cmd(iwm, &invalid, sizeof(invalid), 1); ret = iwm_send_wifi_if_cmd(iwm, &invalid, sizeof(invalid), 1);
if (ret < 0) if (ret)
return ret; return ret;
ret = wait_event_interruptible_timeout(iwm->mlme_queue, ret = wait_event_interruptible_timeout(iwm->mlme_queue,
(iwm->umac_profile_active == 0), 2 * HZ); (iwm->umac_profile_active == 0), 2 * HZ);
if (!ret)
return -EBUSY;
return 0; return ret ? 0 : -EBUSY;
} }
int iwm_send_umac_stats_req(struct iwm_priv *iwm, u32 flags) int iwm_send_umac_stats_req(struct iwm_priv *iwm, u32 flags)
...@@ -869,7 +868,7 @@ int iwm_scan_ssids(struct iwm_priv *iwm, struct cfg80211_ssid *ssids, ...@@ -869,7 +868,7 @@ int iwm_scan_ssids(struct iwm_priv *iwm, struct cfg80211_ssid *ssids,
} }
ret = iwm_send_wifi_if_cmd(iwm, &req, sizeof(req), 0); ret = iwm_send_wifi_if_cmd(iwm, &req, sizeof(req), 0);
if (ret < 0) { if (ret) {
IWM_ERR(iwm, "Couldn't send scan request\n"); IWM_ERR(iwm, "Couldn't send scan request\n");
return ret; return ret;
} }
......
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