Commit fee26e22 authored by Phillip Potter's avatar Phillip Potter Committed by Greg Kroah-Hartman
Browse files

staging: r8188eu: fix lines modified by DBG_88E cleanup



A number of style problems were left behind by the DBG_88E cleanup:
(1) Empty if/else blocks.
(2) Parenthesised if/while statements containing only one line.
(3) Entire blocks which server zero purpose after removal of DBG_88E.
(4) Various warnings about whitespace, and constant comparison order.
(5) Use of __constant_htons instead when htons should be used.

Fix up these issues across the driver in any file touched by the
previous cleanup. Long line warnings will be addresses in a later
patch.

Signed-off-by: default avatarPhillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20220216010709.791-13-phil@philpotter.co.uk


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent db381acc
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -382,7 +382,6 @@ void add_RATid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level)
		psta->raid = raid;
		psta->init_rate = init_rate;

	} else {
	}
}

@@ -457,7 +456,6 @@ void update_bmc_sta(struct adapter *padapter)
		psta->state = _FW_LINKED;
		spin_unlock_bh(&psta->lock);

	} else {
	}
}

@@ -873,8 +871,6 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta)
			psta->no_ht_set = 1;
			pmlmepriv->num_sta_no_ht++;
		}
		if (pmlmepriv->htpriv.ht_option) {
		}
	}

	if (rtw_ht_operation_update(padapter) > 0) {
+8 −14
Original line number Diff line number Diff line
@@ -71,9 +71,8 @@ static int __nat25_add_pppoe_tag(struct sk_buff *skb, struct pppoe_tag *tag)
	int data_len;

	data_len = tag->tag_len + TAG_HDR_LEN;
	if (skb_tailroom(skb) < data_len) {
	if (skb_tailroom(skb) < data_len)
		return -1;
	}

	skb_put(skb, data_len);
	/*  have a room for new tag */
@@ -383,9 +382,8 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
	if (protocol == ETH_P_IP) {
		struct iphdr *iph = (struct iphdr *)(skb->data + ETH_HLEN);

		if (((unsigned char *)(iph) + (iph->ihl<<2)) >= (skb->data + ETH_HLEN + skb->len)) {
		if (((unsigned char *)(iph) + (iph->ihl<<2)) >= (skb->data + ETH_HLEN + skb->len))
			return -1;
		}

		switch (method) {
		case NAT25_CHECK:
@@ -411,9 +409,8 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
		unsigned char *arp_ptr = (unsigned char *)(arp + 1);
		unsigned int *sender;

		if (arp->ar_pro != __constant_htons(ETH_P_IP)) {
		if (arp->ar_pro != htons(ETH_P_IP))
			return -1;
		}

		switch (method) {
		case NAT25_CHECK:
@@ -454,16 +451,15 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
						pOldTag = (struct pppoe_tag *)__nat25_find_pppoe_tag(ph, ntohs(PTT_RELAY_SID));
						if (pOldTag) { /*  if SID existed, copy old value and delete it */
							old_tag_len = ntohs(pOldTag->tag_len);
							if (old_tag_len+TAG_HDR_LEN+MAGIC_CODE_LEN+RTL_RELAY_TAG_LEN > sizeof(tag_buf)) {
							if (old_tag_len+TAG_HDR_LEN+MAGIC_CODE_LEN+RTL_RELAY_TAG_LEN > sizeof(tag_buf))
								return -1;
							}

							memcpy(tag->tag_data+MAGIC_CODE_LEN+RTL_RELAY_TAG_LEN,
								pOldTag->tag_data, old_tag_len);

							if (skb_pull_and_merge(skb, (unsigned char *)pOldTag, TAG_HDR_LEN+old_tag_len) < 0) {
							if (skb_pull_and_merge(skb, (unsigned char *)pOldTag, TAG_HDR_LEN+old_tag_len) < 0)
								return -1;
							}

							ph->length = htons(ntohs(ph->length)-TAG_HDR_LEN-old_tag_len);
						}

@@ -480,9 +476,8 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
							return -1;
					} else { /*  not add relay tag */
						if (priv->pppoe_connection_in_progress &&
								memcmp(skb->data+ETH_ALEN, priv->pppoe_addr, ETH_ALEN))	 {
								memcmp(skb->data+ETH_ALEN, priv->pppoe_addr, ETH_ALEN))
							return -2;
						}

						if (priv->pppoe_connection_in_progress == 0)
							memcpy(priv->pppoe_addr, skb->data+ETH_ALEN, ETH_ALEN);
@@ -536,9 +531,8 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
		/*------------------------------------------------*/
		struct ipv6hdr *iph = (struct ipv6hdr *)(skb->data + ETH_HLEN);

		if (sizeof(*iph) >= (skb->len - ETH_HLEN)) {
		if (sizeof(*iph) >= (skb->len - ETH_HLEN))
			return -1;
		}

		switch (method) {
		case NAT25_CHECK:
+2 −4
Original line number Diff line number Diff line
@@ -251,9 +251,8 @@ int rtw_cmd_thread(void *context)

_next:
		if (padapter->bDriverStopped ||
		    padapter->bSurpriseRemoved) {
		    padapter->bSurpriseRemoved)
			break;
		}

		pcmd = rtw_dequeue_cmd(pcmdpriv);
		if (!pcmd)
@@ -937,9 +936,8 @@ static void rtl8188e_sreset_xmit_status_check(struct adapter *padapter)
	u32 txdma_status;

	txdma_status = rtw_read32(padapter, REG_TXDMA_STATUS);
	if (txdma_status != 0x00) {
	if (txdma_status != 0x00)
		rtw_write32(padapter, REG_TXDMA_STATUS, txdma_status);
	}
	/* total xmit irp = 4 */
}

+4 −8
Original line number Diff line number Diff line
@@ -190,9 +190,8 @@ static int fw_free_to_go(struct adapter *padapter)
			break;
	} while (counter++ < POLLING_READY_TIMEOUT_COUNT);

	if (counter >= POLLING_READY_TIMEOUT_COUNT) {
	if (counter >= POLLING_READY_TIMEOUT_COUNT)
		return _FAIL;
	}

	value32 = rtw_read32(padapter, REG_MCUFWDL);
	value32 |= MCUFWDL_RDY;
@@ -205,9 +204,8 @@ static int fw_free_to_go(struct adapter *padapter)
	counter = 0;
	do {
		value32 = rtw_read32(padapter, REG_MCUFWDL);
		if (value32 & WINTINI_RDY) {
		if (value32 & WINTINI_RDY)
			return _SUCCESS;
		}
		udelay(5);
	} while (counter++ < POLLING_READY_TIMEOUT_COUNT);

@@ -304,14 +302,12 @@ int rtl8188e_firmware_download(struct adapter *padapter)
			break;
	}
	fw_download_enable(padapter, false);
	if (ret != _SUCCESS) {
	if (ret != _SUCCESS)
		goto exit;
	}

	ret = fw_free_to_go(padapter);
	if (ret != _SUCCESS) {
	if (ret != _SUCCESS)
		goto exit;
	}

exit:
	return ret;
+4 −14
Original line number Diff line number Diff line
@@ -653,11 +653,8 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen,
	/* first 3 bytes in vendor specific information element are the IEEE
	 * OUI of the vendor. The following byte is used a vendor specific
	 * sub-type. */
	if (elen < 4) {
		if (show_errors) {
		}
	if (elen < 4)
		return -1;
	}

	oui = RTW_GET_BE24(pos);
	switch (oui) {
@@ -672,9 +669,8 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen,
			elems->wpa_ie_len = elen;
			break;
		case WME_OUI_TYPE: /* this is a Wi-Fi WME info. element */
			if (elen < 5) {
			if (elen < 5)
				return -1;
			}
			switch (pos[4]) {
			case WME_OUI_SUBTYPE_INFORMATION_ELEMENT:
			case WME_OUI_SUBTYPE_PARAMETER_ELEMENT:
@@ -740,11 +736,8 @@ enum parse_res rtw_ieee802_11_parse_elems(u8 *start, uint len,
		elen = *pos++;
		left -= 2;

		if (elen > left) {
			if (show_errors) {
			}
		if (elen > left)
			return ParseFailed;
		}

		switch (id) {
		case WLAN_EID_SSID:
@@ -825,8 +818,6 @@ enum parse_res rtw_ieee802_11_parse_elems(u8 *start, uint len,
			break;
		default:
			unknown++;
			if (!show_errors)
				break;
			break;
		}
		left -= elen;
@@ -874,10 +865,9 @@ void rtw_macaddr_cfg(u8 *mac_addr)
		ether_addr_copy(mac, mac_addr);
	}

	if (is_broadcast_ether_addr(mac) || is_zero_ether_addr(mac)) {
	if (is_broadcast_ether_addr(mac) || is_zero_ether_addr(mac))
		eth_random_addr(mac_addr);
}
}

/**
 * rtw_get_p2p_ie - Search P2P IE from a series of IEs
Loading