staging: r8188eu: convert rtw_setdatarate_cmd to correct error semantics
Convert rtw_setdatarate_cmd function to use proper error return codes rather than _SUCCESS and _FAIL, and a simpler 'return 0;' style. For now, wrap rtw_enqueue_cmd call and return -EPERM if it fails, as converting this function makes more sense later on due to its large number of callers. Also change rtw_wx_set_rate function to pass through the proper error code rather than just 0 or -1. Signed-off-by: Phillip Potter <phil@philpotter.co.uk> Link: https://lore.kernel.org/r/20221102003613.971-1-phil@philpotter.co.uk Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
d911a624cf
commit
a370687159
|
@ -340,33 +340,29 @@ u8 rtw_sitesurvey_cmd(struct adapter *padapter, struct ndis_802_11_ssid *ssid,
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 rtw_setdatarate_cmd(struct adapter *padapter, u8 *rateset)
|
int rtw_setdatarate_cmd(struct adapter *padapter, u8 *rateset)
|
||||||
{
|
{
|
||||||
struct cmd_obj *ph2c;
|
struct cmd_obj *ph2c;
|
||||||
struct setdatarate_parm *pbsetdataratepara;
|
struct setdatarate_parm *pbsetdataratepara;
|
||||||
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
|
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
|
||||||
u8 res = _SUCCESS;
|
|
||||||
|
|
||||||
ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC);
|
ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC);
|
||||||
if (!ph2c) {
|
if (!ph2c)
|
||||||
res = _FAIL;
|
return -ENOMEM;
|
||||||
goto exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
pbsetdataratepara = kzalloc(sizeof(*pbsetdataratepara), GFP_ATOMIC);
|
pbsetdataratepara = kzalloc(sizeof(*pbsetdataratepara), GFP_ATOMIC);
|
||||||
if (!pbsetdataratepara) {
|
if (!pbsetdataratepara) {
|
||||||
kfree(ph2c);
|
kfree(ph2c);
|
||||||
res = _FAIL;
|
return -ENOMEM;
|
||||||
goto exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
init_h2fwcmd_w_parm_no_rsp(ph2c, pbsetdataratepara, GEN_CMD_CODE(_SetDataRate));
|
init_h2fwcmd_w_parm_no_rsp(ph2c, pbsetdataratepara, GEN_CMD_CODE(_SetDataRate));
|
||||||
pbsetdataratepara->mac_id = 5;
|
pbsetdataratepara->mac_id = 5;
|
||||||
memcpy(pbsetdataratepara->datarates, rateset, NumRates);
|
memcpy(pbsetdataratepara->datarates, rateset, NumRates);
|
||||||
res = rtw_enqueue_cmd(pcmdpriv, ph2c);
|
if (rtw_enqueue_cmd(pcmdpriv, ph2c) == _FAIL)
|
||||||
exit:
|
return -EPERM;
|
||||||
|
|
||||||
return res;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rtw_getbbrfreg_cmdrsp_callback(struct adapter *padapter, struct cmd_obj *pcmd)
|
void rtw_getbbrfreg_cmdrsp_callback(struct adapter *padapter, struct cmd_obj *pcmd)
|
||||||
|
|
|
@ -727,7 +727,7 @@ u8 rtw_clearstakey_cmd(struct adapter *padapter, u8 *psta, u8 entry, u8 enqueue)
|
||||||
u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork);
|
u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork);
|
||||||
u8 rtw_disassoc_cmd(struct adapter *padapter, u32 deauth_timeout_ms, bool enqueue);
|
u8 rtw_disassoc_cmd(struct adapter *padapter, u32 deauth_timeout_ms, bool enqueue);
|
||||||
u8 rtw_setopmode_cmd(struct adapter *padapter, enum ndis_802_11_network_infra networktype);
|
u8 rtw_setopmode_cmd(struct adapter *padapter, enum ndis_802_11_network_infra networktype);
|
||||||
u8 rtw_setdatarate_cmd(struct adapter *padapter, u8 *rateset);
|
int rtw_setdatarate_cmd(struct adapter *padapter, u8 *rateset);
|
||||||
u8 rtw_setrfintfs_cmd(struct adapter *padapter, u8 mode);
|
u8 rtw_setrfintfs_cmd(struct adapter *padapter, u8 mode);
|
||||||
|
|
||||||
u8 rtw_gettssi_cmd(struct adapter *padapter, u8 offset, u8 *pval);
|
u8 rtw_gettssi_cmd(struct adapter *padapter, u8 offset, u8 *pval);
|
||||||
|
|
|
@ -1340,7 +1340,7 @@ static int rtw_wx_set_rate(struct net_device *dev,
|
||||||
struct iw_request_info *a,
|
struct iw_request_info *a,
|
||||||
union iwreq_data *wrqu, char *extra)
|
union iwreq_data *wrqu, char *extra)
|
||||||
{
|
{
|
||||||
int i, ret = 0;
|
int i;
|
||||||
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
|
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
|
||||||
u8 datarates[NumRates];
|
u8 datarates[NumRates];
|
||||||
u32 target_rate = wrqu->bitrate.value;
|
u32 target_rate = wrqu->bitrate.value;
|
||||||
|
@ -1408,10 +1408,7 @@ set_rate:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rtw_setdatarate_cmd(padapter, datarates) != _SUCCESS)
|
return rtw_setdatarate_cmd(padapter, datarates);
|
||||||
ret = -1;
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rtw_wx_get_rate(struct net_device *dev,
|
static int rtw_wx_get_rate(struct net_device *dev,
|
||||||
|
|
Loading…
Reference in New Issue