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

Commit 1ce7948f authored by Somya Anand's avatar Somya Anand Committed by Greg Kroah-Hartman
Browse files

Staging: rtl8188eu: Remove redundant local variable



This patch removes a redundant variable "val" and adds
inline return statements. It also adds a default case
to the switch statement which returns 0 to keep the logic
intact.

It also removes a redundant variable "inx" and adds inline
return statements.

This issue is identified by the following coccinelle script.
@@
expression ret;
identifier f;
@@

-ret =
+return
     f(...);
-return ret;

Signed-off-by: default avatarSomya Anand <somyaanand214@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5b4ac54f
Loading
Loading
Loading
Loading
+28 −53
Original line number Original line Diff line number Diff line
@@ -136,47 +136,34 @@ u8 judge_network_type(struct adapter *padapter, unsigned char *rate, int ratelen


static unsigned char ratetbl_val_2wifirate(unsigned char rate)
static unsigned char ratetbl_val_2wifirate(unsigned char rate)
{
{
	unsigned char val = 0;

	switch (rate & 0x7f) {
	switch (rate & 0x7f) {
	case 0:
	case 0:
		val = IEEE80211_CCK_RATE_1MB;
		return IEEE80211_CCK_RATE_1MB;
		break;
	case 1:
	case 1:
		val = IEEE80211_CCK_RATE_2MB;
		return IEEE80211_CCK_RATE_2MB;
		break;
	case 2:
	case 2:
		val = IEEE80211_CCK_RATE_5MB;
		return IEEE80211_CCK_RATE_5MB;
		break;
	case 3:
	case 3:
		val = IEEE80211_CCK_RATE_11MB;
		return IEEE80211_CCK_RATE_11MB;
		break;
	case 4:
	case 4:
		val = IEEE80211_OFDM_RATE_6MB;
		return IEEE80211_OFDM_RATE_6MB;
		break;
	case 5:
	case 5:
		val = IEEE80211_OFDM_RATE_9MB;
		return IEEE80211_OFDM_RATE_9MB;
		break;
	case 6:
	case 6:
		val = IEEE80211_OFDM_RATE_12MB;
		return IEEE80211_OFDM_RATE_12MB;
		break;
	case 7:
	case 7:
		val = IEEE80211_OFDM_RATE_18MB;
		return IEEE80211_OFDM_RATE_18MB;
		break;
	case 8:
	case 8:
		val = IEEE80211_OFDM_RATE_24MB;
		return IEEE80211_OFDM_RATE_24MB;
		break;
	case 9:
	case 9:
		val = IEEE80211_OFDM_RATE_36MB;
		return IEEE80211_OFDM_RATE_36MB;
		break;
	case 10:
	case 10:
		val = IEEE80211_OFDM_RATE_48MB;
		return IEEE80211_OFDM_RATE_48MB;
		break;
	case 11:
	case 11:
		val = IEEE80211_OFDM_RATE_54MB;
		return IEEE80211_OFDM_RATE_54MB;
		break;
	default:
		return 0;
	}
	}
	return val;
}
}


static int is_basicrate(struct adapter *padapter, unsigned char rate)
static int is_basicrate(struct adapter *padapter, unsigned char rate)
@@ -1209,48 +1196,36 @@ unsigned int is_ap_in_wep(struct adapter *padapter)


static int wifirate2_ratetbl_inx(unsigned char rate)
static int wifirate2_ratetbl_inx(unsigned char rate)
{
{
	int	inx = 0;
	rate = rate & 0x7f;
	rate = rate & 0x7f;


	switch (rate) {
	switch (rate) {
	case 54*2:
	case 54*2:
		inx = 11;
		return 11;
		break;
	case 48*2:
	case 48*2:
		inx = 10;
		return 10;
		break;
	case 36*2:
	case 36*2:
		inx = 9;
		return 9;
		break;
	case 24*2:
	case 24*2:
		inx = 8;
		return 8;
		break;
	case 18*2:
	case 18*2:
		inx = 7;
		return 7;
		break;
	case 12*2:
	case 12*2:
		inx = 6;
		return 6;
		break;
	case 9*2:
	case 9*2:
		inx = 5;
		return 5;
		break;
	case 6*2:
	case 6*2:
		inx = 4;
		return 4;
		break;
	case 11*2:
	case 11*2:
		inx = 3;
		return 3;
		break;
	case 11:
	case 11:
		inx = 2;
		return 2;
		break;
	case 2*2:
	case 2*2:
		inx = 1;
		return 1;
		break;
	case 1*2:
	case 1*2:
		inx = 0;
		return 0;
		break;
	default:
		return 0;
	}
	}
	return inx;
}
}


unsigned int update_basic_rate(unsigned char *ptn, unsigned int ptn_sz)
unsigned int update_basic_rate(unsigned char *ptn, unsigned int ptn_sz)