wil6210: unify wmi_set_ie() error handling

When printing error message, provide string describing IE kind.
Derive it from IE type
This allows removing of error messages printing
in callers

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
This commit is contained in:
Vladimir Kondratiev 2015-07-30 13:52:00 +03:00 committed by Kalle Valo
parent cab5abbf9d
commit 5421bf0c1e
2 changed files with 25 additions and 23 deletions

View File

@ -336,12 +336,9 @@ static int wil_cfg80211_scan(struct wiphy *wiphy,
else
wil_dbg_misc(wil, "Scan has no IE's\n");
rc = wmi_set_ie(wil, WMI_FRAME_PROBE_REQ, request->ie_len,
request->ie);
if (rc) {
wil_err(wil, "Aborting scan, set_ie failed: %d\n", rc);
rc = wmi_set_ie(wil, WMI_FRAME_PROBE_REQ, request->ie_len, request->ie);
if (rc)
goto out;
}
rc = wmi_send(wil, WMI_START_SCAN_CMDID, &cmd, sizeof(cmd.cmd) +
cmd.cmd.num_channels * sizeof(cmd.cmd.channel_list[0]));
@ -462,10 +459,8 @@ static int wil_cfg80211_connect(struct wiphy *wiphy,
* ies in FW.
*/
rc = wmi_set_ie(wil, WMI_FRAME_ASSOC_REQ, sme->ie_len, sme->ie);
if (rc) {
wil_err(wil, "WMI_SET_APPIE_CMD failed\n");
if (rc)
goto out;
}
/* WMI_CONNECT_CMD */
memset(&conn, 0, sizeof(conn));
@ -748,27 +743,19 @@ static int _wil_cfg80211_set_ies(struct wiphy *wiphy,
rc = wmi_set_ie(wil, WMI_FRAME_PROBE_RESP, bcon->proberesp_ies_len,
bcon->proberesp_ies);
if (rc) {
wil_err(wil, "set_ie(PROBE_RESP) failed\n");
if (rc)
return rc;
}
rc = wmi_set_ie(wil, WMI_FRAME_ASSOC_RESP, bcon->assocresp_ies_len,
bcon->assocresp_ies);
if (rc) {
wil_err(wil, "set_ie(ASSOC_RESP) failed\n");
return rc;
}
#if 0 /* to use beacon IE's, remove this #if 0 */
rc = wmi_set_ie(wil, WMI_FRAME_BEACON, bcon->tail_len,
bcon->tail);
if (rc) {
wil_err(wil, "set_ie(BEACON) failed\n");
if (rc)
return rc;
}
rc = wmi_set_ie(wil, WMI_FRAME_BEACON, bcon->tail_len, bcon->tail);
#endif
return 0;
return rc;
}
static int _wil_cfg80211_start_ap(struct wiphy *wiphy,

View File

@ -1022,12 +1022,21 @@ int wmi_add_cipher_key(struct wil6210_priv *wil, u8 key_index,
int wmi_set_ie(struct wil6210_priv *wil, u8 type, u16 ie_len, const void *ie)
{
static const char *const names[] = {
[WMI_FRAME_BEACON] = "BEACON",
[WMI_FRAME_PROBE_REQ] = "PROBE_REQ",
[WMI_FRAME_PROBE_RESP] = "WMI_FRAME_PROBE_RESP",
[WMI_FRAME_ASSOC_REQ] = "WMI_FRAME_ASSOC_REQ",
[WMI_FRAME_ASSOC_RESP] = "WMI_FRAME_ASSOC_RESP",
};
int rc;
u16 len = sizeof(struct wmi_set_appie_cmd) + ie_len;
struct wmi_set_appie_cmd *cmd = kzalloc(len, GFP_KERNEL);
if (!cmd)
return -ENOMEM;
if (!cmd) {
rc = -ENOMEM;
goto out;
}
if (!ie)
ie_len = 0;
@ -1037,6 +1046,12 @@ int wmi_set_ie(struct wil6210_priv *wil, u8 type, u16 ie_len, const void *ie)
memcpy(cmd->ie_info, ie, ie_len);
rc = wmi_send(wil, WMI_SET_APPIE_CMDID, cmd, len);
kfree(cmd);
out:
if (rc) {
const char *name = type < ARRAY_SIZE(names) ?
names[type] : "??";
wil_err(wil, "set_ie(%d %s) failed : %d\n", type, name, rc);
}
return rc;
}