Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8ffca9ea authored by Peter Senna Tschudin's avatar Peter Senna Tschudin Committed by Greg Kroah-Hartman
Browse files

staging: r8712u: Remove useless return variables



This patch remove variables that are initialized with a constant,
are never updated, and are only used as parameter of return.
Return the constant instead of using a variable.

Verified by compilation only.

The coccinelle script that find and fixes this issue is:
// <smpl>
@@
type T;
constant C;
identifier ret;
@@
- T ret = C;
... when != ret
- return ret;
+ return C;
// </smpl>

Signed-off-by: default avatarPeter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8a5e7b01
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -289,7 +289,7 @@ static int r8712_get_wpa2_cipher_suite(u8 *s)
int r8712_parse_wpa_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher,
		 int *pairwise_cipher)
{
	int i, ret = _SUCCESS;
	int i;
	int left, count;
	u8 *pos;

@@ -324,13 +324,13 @@ int r8712_parse_wpa_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher,
		}
	} else if (left == 1)
		return _FAIL;
	return ret;
	return _SUCCESS;
}

int r8712_parse_wpa2_ie(u8 *rsn_ie, int rsn_ie_len, int *group_cipher,
		  int *pairwise_cipher)
{
	int i, ret = _SUCCESS;
	int i;
	int left, count;
	u8 *pos;

@@ -364,7 +364,7 @@ int r8712_parse_wpa2_ie(u8 *rsn_ie, int rsn_ie_len, int *group_cipher,
		}
	} else if (left == 1)
		return _FAIL;
	return ret;
	return _SUCCESS;
}

int r8712_get_sec_ie(u8 *in_ie, uint in_len, u8 *rsn_ie, u16 *rsn_len,
+1 −2
Original line number Diff line number Diff line
@@ -290,8 +290,7 @@ static struct cmd_obj *cmd_hdl_filter(struct _adapter *padapter,

static u8 check_cmd_fifo(struct _adapter *padapter, uint sz)
{
	u8 res = _SUCCESS;
	return res;
	return _SUCCESS;
}

u8 r8712_fw_cmd(struct _adapter *pAdapter, u32 cmd)
+2 −5
Original line number Diff line number Diff line
@@ -123,8 +123,6 @@ void r8712_free_recv_priv(struct recv_priv *precvpriv)

int r8712_init_recvbuf(struct _adapter *padapter, struct recv_buf *precvbuf)
{
	int res = _SUCCESS;

	precvbuf->transfer_len = 0;
	precvbuf->len = 0;
	precvbuf->ref_cnt = 0;
@@ -134,7 +132,7 @@ int r8712_init_recvbuf(struct _adapter *padapter, struct recv_buf *precvbuf)
		precvbuf->ptail = precvbuf->pbuf;
		precvbuf->pend = precvbuf->pdata + MAX_RECVBUF_SZ;
	}
	return res;
	return _SUCCESS;
}

int r8712_free_recvframe(union recv_frame *precvframe,
@@ -347,7 +345,6 @@ static int amsdu_to_msdu(struct _adapter *padapter, union recv_frame *prframe)
	_pkt *sub_skb, *subframes[MAX_SUBFRAME_COUNT];
	struct recv_priv *precvpriv = &padapter->recvpriv;
	struct  __queue *pfree_recv_queue = &(precvpriv->free_recv_queue);
	int	ret = _SUCCESS;

	nr_subframes = 0;
	pattrib = &prframe->u.hdr.attrib;
@@ -435,7 +432,7 @@ static int amsdu_to_msdu(struct _adapter *padapter, union recv_frame *prframe)
exit:
	prframe->u.hdr.len = 0;
	r8712_free_recvframe(prframe, pfree_recv_queue);
	return ret;
	return _SUCCESS;
}

void r8712_rxcmd_event_hdl(struct _adapter *padapter, void *prxcmdbuf)
+1 −2
Original line number Diff line number Diff line
@@ -1211,7 +1211,6 @@ sint r8712_set_auth(struct _adapter *adapter,
	struct cmd_priv	*pcmdpriv = &adapter->cmdpriv;
	struct cmd_obj *pcmd;
	struct setauth_parm *psetauthparm;
	sint ret = _SUCCESS;

	pcmd = (struct cmd_obj *)_malloc(sizeof(struct cmd_obj));
	if (pcmd == NULL)
@@ -1232,7 +1231,7 @@ sint r8712_set_auth(struct _adapter *adapter,
	pcmd->rspsz = 0;
	_init_listhead(&pcmd->list);
	r8712_enqueue_cmd(pcmdpriv, pcmd);
	return ret;
	return _SUCCESS;
}

sint r8712_set_key(struct _adapter *adapter,
+1 −2
Original line number Diff line number Diff line
@@ -80,9 +80,8 @@ static int init_mp_priv(struct mp_priv *pmp_priv)

static int free_mp_priv(struct mp_priv *pmp_priv)
{
	int res = 0;
	kfree(pmp_priv->pallocated_mp_xmitframe_buf);
	return res;
	return 0;
}

void mp871xinit(struct _adapter *padapter)
Loading