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

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.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ed5d2eaf
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -173,7 +173,7 @@ void _free_xmit_priv(struct xmit_priv *pxmitpriv)
	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_file pktfile;
@@ -224,7 +224,7 @@ sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt,
	} else if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) {
		/*firstly, filter packet not belongs to mp*/
		if (pattrib->ether_type != 0x8712)
			return _FAIL;
			return -EINVAL;
		/* for mp storing the txcmd per packet,
		 * according to the info of txcmd to update pattrib
		 */
@@ -271,7 +271,7 @@ sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt,
		} else {
			psta = r8712_get_stainfo(pstapriv, pattrib->ra);
			if (psta == NULL)  /* drop the pkt */
				return _FAIL;
				return -ENOMEM;
			if (check_fwstate(pmlmepriv, WIFI_STATION_STATE))
				pattrib->mac_id = 5;
			else
@@ -283,7 +283,7 @@ sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt,
		pattrib->psta = psta;
	} else {
		/* if we cannot get psta => drrp the pkt */
		return _FAIL;
		return -ENOMEM;
	}

	pattrib->ack_policy = 0;
@@ -301,7 +301,7 @@ sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt,
		pattrib->encrypt = 0;
		if ((pattrib->ether_type != 0x888e) &&
		    !check_fwstate(pmlmepriv, WIFI_MP_STATE))
			return _FAIL;
			return -EINVAL;
	} else {
		GET_ENCRY_ALGO(psecuritypriv, psta, pattrib->encrypt, bmcast);
	}
@@ -315,7 +315,7 @@ sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt,
		pattrib->iv_len = 8;
		pattrib->icv_len = 4;
		if (padapter->securitypriv.busetkipkey == _FAIL)
			return _FAIL;
			return -EINVAL;
		break;
	case _AES_:
		pattrib->iv_len = 8;
@@ -339,7 +339,7 @@ sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt,
	if (check_fwstate(pmlmepriv, WIFI_MP_STATE))
		pattrib->priority =
		    (le32_to_cpu(txdesc.txdw1) >> QSEL_SHT) & 0x1f;
	return _SUCCESS;
	return 0;
}

static sint xmitframe_addmic(struct _adapter *padapter,
+2 −2
Original line number Diff line number Diff line
@@ -264,7 +264,7 @@ sint r8712_xmitframe_coalesce(struct _adapter *padapter, _pkt *pkt,
			      struct xmit_frame *pxmitframe);
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);
sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt,
int r8712_update_attrib(struct _adapter *padapter, _pkt *pkt,
			struct pkt_attrib *pattrib);
int r8712_txframes_sta_ac_pending(struct _adapter *padapter,
				  struct pkt_attrib *pattrib);
+1 −1
Original line number Diff line number Diff line
@@ -160,7 +160,7 @@ int r8712_xmit_entry(_pkt *pkt, struct net_device *netdev)
	if (!xmitframe)
		goto _xmit_entry_drop;

	if ((!r8712_update_attrib(adapter, pkt, &xmitframe->attrib)))
	if (r8712_update_attrib(adapter, pkt, &xmitframe->attrib))
		goto _xmit_entry_drop;

	adapter->ledpriv.LedControlHandler(adapter, LED_CTL_TX);