Commit b013c5b8 authored by Nishka Dasgupta's avatar Nishka Dasgupta Committed by Greg Kroah-Hartman

staging: rtl8712: r8712_update_attrib(): Change return values and type

Change return values of r8712_update_attrib from _SUCCESS and _FAIL to 0
and -ENOMEM or -EINVAL respectively. Modify call site to check for the
new failure conditions. Also modify the return type from sint to int.
Signed-off-by: default avatarNishka Dasgupta <nishkadg.linux@gmail.com>
Link: https://lore.kernel.org/r/20190809052353.5308-2-nishkadg.linux@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ed5d2eaf
...@@ -173,7 +173,7 @@ void _free_xmit_priv(struct xmit_priv *pxmitpriv) ...@@ -173,7 +173,7 @@ void _free_xmit_priv(struct xmit_priv *pxmitpriv)
free_hwxmits(padapter); free_hwxmits(padapter);
} }
sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt, int r8712_update_attrib(struct _adapter *padapter, _pkt *pkt,
struct pkt_attrib *pattrib) struct pkt_attrib *pattrib)
{ {
struct pkt_file pktfile; struct pkt_file pktfile;
...@@ -224,7 +224,7 @@ sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt, ...@@ -224,7 +224,7 @@ sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt,
} else if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) { } else if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) {
/*firstly, filter packet not belongs to mp*/ /*firstly, filter packet not belongs to mp*/
if (pattrib->ether_type != 0x8712) if (pattrib->ether_type != 0x8712)
return _FAIL; return -EINVAL;
/* for mp storing the txcmd per packet, /* for mp storing the txcmd per packet,
* according to the info of txcmd to update pattrib * according to the info of txcmd to update pattrib
*/ */
...@@ -271,7 +271,7 @@ sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt, ...@@ -271,7 +271,7 @@ sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt,
} else { } else {
psta = r8712_get_stainfo(pstapriv, pattrib->ra); psta = r8712_get_stainfo(pstapriv, pattrib->ra);
if (psta == NULL) /* drop the pkt */ if (psta == NULL) /* drop the pkt */
return _FAIL; return -ENOMEM;
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) if (check_fwstate(pmlmepriv, WIFI_STATION_STATE))
pattrib->mac_id = 5; pattrib->mac_id = 5;
else else
...@@ -283,7 +283,7 @@ sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt, ...@@ -283,7 +283,7 @@ sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt,
pattrib->psta = psta; pattrib->psta = psta;
} else { } else {
/* if we cannot get psta => drrp the pkt */ /* if we cannot get psta => drrp the pkt */
return _FAIL; return -ENOMEM;
} }
pattrib->ack_policy = 0; pattrib->ack_policy = 0;
...@@ -301,7 +301,7 @@ sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt, ...@@ -301,7 +301,7 @@ sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt,
pattrib->encrypt = 0; pattrib->encrypt = 0;
if ((pattrib->ether_type != 0x888e) && if ((pattrib->ether_type != 0x888e) &&
!check_fwstate(pmlmepriv, WIFI_MP_STATE)) !check_fwstate(pmlmepriv, WIFI_MP_STATE))
return _FAIL; return -EINVAL;
} else { } else {
GET_ENCRY_ALGO(psecuritypriv, psta, pattrib->encrypt, bmcast); GET_ENCRY_ALGO(psecuritypriv, psta, pattrib->encrypt, bmcast);
} }
...@@ -315,7 +315,7 @@ sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt, ...@@ -315,7 +315,7 @@ sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt,
pattrib->iv_len = 8; pattrib->iv_len = 8;
pattrib->icv_len = 4; pattrib->icv_len = 4;
if (padapter->securitypriv.busetkipkey == _FAIL) if (padapter->securitypriv.busetkipkey == _FAIL)
return _FAIL; return -EINVAL;
break; break;
case _AES_: case _AES_:
pattrib->iv_len = 8; pattrib->iv_len = 8;
...@@ -339,7 +339,7 @@ sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt, ...@@ -339,7 +339,7 @@ sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt,
if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) if (check_fwstate(pmlmepriv, WIFI_MP_STATE))
pattrib->priority = pattrib->priority =
(le32_to_cpu(txdesc.txdw1) >> QSEL_SHT) & 0x1f; (le32_to_cpu(txdesc.txdw1) >> QSEL_SHT) & 0x1f;
return _SUCCESS; return 0;
} }
static sint xmitframe_addmic(struct _adapter *padapter, static sint xmitframe_addmic(struct _adapter *padapter,
......
...@@ -264,7 +264,7 @@ sint r8712_xmitframe_coalesce(struct _adapter *padapter, _pkt *pkt, ...@@ -264,7 +264,7 @@ sint r8712_xmitframe_coalesce(struct _adapter *padapter, _pkt *pkt,
struct xmit_frame *pxmitframe); struct xmit_frame *pxmitframe);
sint _r8712_init_hw_txqueue(struct hw_txqueue *phw_txqueue, u8 ac_tag); sint _r8712_init_hw_txqueue(struct hw_txqueue *phw_txqueue, u8 ac_tag);
void _r8712_init_sta_xmit_priv(struct sta_xmit_priv *psta_xmitpriv); void _r8712_init_sta_xmit_priv(struct sta_xmit_priv *psta_xmitpriv);
sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt, int r8712_update_attrib(struct _adapter *padapter, _pkt *pkt,
struct pkt_attrib *pattrib); struct pkt_attrib *pattrib);
int r8712_txframes_sta_ac_pending(struct _adapter *padapter, int r8712_txframes_sta_ac_pending(struct _adapter *padapter,
struct pkt_attrib *pattrib); struct pkt_attrib *pattrib);
......
...@@ -160,7 +160,7 @@ int r8712_xmit_entry(_pkt *pkt, struct net_device *netdev) ...@@ -160,7 +160,7 @@ int r8712_xmit_entry(_pkt *pkt, struct net_device *netdev)
if (!xmitframe) if (!xmitframe)
goto _xmit_entry_drop; goto _xmit_entry_drop;
if ((!r8712_update_attrib(adapter, pkt, &xmitframe->attrib))) if (r8712_update_attrib(adapter, pkt, &xmitframe->attrib))
goto _xmit_entry_drop; goto _xmit_entry_drop;
adapter->ledpriv.LedControlHandler(adapter, LED_CTL_TX); adapter->ledpriv.LedControlHandler(adapter, LED_CTL_TX);
......
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