diff mbox

[Resend,OPW,kernel] Staging: rtl8712: fixed else after return or break warning

Message ID 20140921002319.GA4291@Tapasweni.Pathak
State New, archived
Headers show

Commit Message

Tapasweni Pathak Sept. 21, 2014, 12:23 a.m. UTC
This patch fixes checkpatch.pl warning in files of rtl8712
WARNING : else is not generally useful after a break or return

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
---
 drivers/staging/rtl8712/rtl8712_recv.c        |   15 ++---
 drivers/staging/rtl8712/rtl871x_ioctl_linux.c |    7 +--
 drivers/staging/rtl8712/rtl871x_ioctl_set.c   |   73 ++++++++++++-------------
 drivers/staging/rtl8712/rtl871x_mlme.c        |   10 +---
 drivers/staging/rtl8712/wifi.h                |    3 +-
 drivers/staging/rtl8712/xmit_linux.c          |    3 +-
 6 files changed, 50 insertions(+), 61 deletions(-)

--
1.7.0.4

Comments

Greg Kroah-Hartman Sept. 23, 2014, 3:13 p.m. UTC | #1
On Sun, Sep 21, 2014 at 05:53:19AM +0530, Tapasweni Pathak wrote:
> This patch fixes checkpatch.pl warning in files of rtl8712
> WARNING : else is not generally useful after a break or return
> 
> Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
> ---
>  drivers/staging/rtl8712/rtl8712_recv.c        |   15 ++---
>  drivers/staging/rtl8712/rtl871x_ioctl_linux.c |    7 +--
>  drivers/staging/rtl8712/rtl871x_ioctl_set.c   |   73 ++++++++++++-------------
>  drivers/staging/rtl8712/rtl871x_mlme.c        |   10 +---
>  drivers/staging/rtl8712/wifi.h                |    3 +-
>  drivers/staging/rtl8712/xmit_linux.c          |    3 +-
>  6 files changed, 50 insertions(+), 61 deletions(-)

This patch adds a build warning to the kernel build process, which isn't
allowed and should give you a hint that the patch isn't correct.

Please fix it up and resend.

thanks,

greg k-h
diff mbox

Patch

diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c
index df1e498..bf4fa17 100644
--- a/drivers/staging/rtl8712/rtl8712_recv.c
+++ b/drivers/staging/rtl8712/rtl8712_recv.c
@@ -533,11 +533,9 @@  int r8712_recv_indicatepkts_in_order(struct _adapter *padapter,
 	if (bforced == true) {
 		if (list_empty(phead))
 			return true;
-		else {
-			prframe = LIST_CONTAINOR(plist, union recv_frame, u);
-			pattrib = &prframe->u.hdr.attrib;
-			preorder_ctrl->indicate_seq = pattrib->seq_num;
-		}
+		prframe = LIST_CONTAINOR(plist, union recv_frame, u);
+		pattrib = &prframe->u.hdr.attrib;
+		preorder_ctrl->indicate_seq = pattrib->seq_num;
 	}
 	/* Prepare indication list and indication.
 	 * Check if there is any packet need indicate. */
@@ -592,8 +590,8 @@  static int recv_indicatepkt_reorder(struct _adapter *padapter,
 			   (padapter->bSurpriseRemoved == false)) {
 				r8712_recv_indicatepkt(padapter, prframe);
 				return _SUCCESS;
-			} else
-				return _FAIL;
+			}
+			return _FAIL;
 		}
 	}
 	spin_lock_irqsave(&ppending_recvframe_queue->lock, irql);
@@ -679,8 +677,7 @@  static u8 query_rx_pwr_percentage(s8 antpower)
 		return	0;
 	else if (antpower >= 0)
 		return	100;
-	else
-		return 100 + antpower;
+	return 100 + antpower;
 }

 static u8 evm_db2percentage(s8 value)
diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
index 98bcf69..acaebde 100644
--- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
+++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
@@ -619,8 +619,8 @@  static int r871x_set_wpa_ie(struct _adapter *padapter, char *pie,
 					netdev_info(padapter->pnetdev, "r8712u: SET WPS_IE, wps_phase==true\n");
 					cnt += buf[cnt+1]+2;
 					break;
-				} else
-					cnt += buf[cnt + 1] + 2;
+				}
+				cnt += buf[cnt + 1] + 2;
 			}
 		}
 	}
@@ -817,8 +817,7 @@  static int r871x_wx_set_pmkid(struct net_device *dev,
 	case IW_PMKSA_ADD:
 		if (!memcmp(strIssueBssid, strZeroMacAddress, ETH_ALEN))
 			return intReturn;
-		else
-			intReturn = true;
+		intReturn = true;
 		blInserted = false;
 		/* overwrite PMKID */
 		for (j = 0; j < NUM_PMKID_CACHE; j++) {
diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_set.c b/drivers/staging/rtl8712/rtl871x_ioctl_set.c
index 9d47eb4..088d349 100644
--- a/drivers/staging/rtl8712/rtl871x_ioctl_set.c
+++ b/drivers/staging/rtl8712/rtl871x_ioctl_set.c
@@ -80,44 +80,43 @@  static u8 do_join(struct _adapter *padapter)
 		if (pmlmepriv->sitesurveyctrl.traffic_busy == false)
 			r8712_sitesurvey_cmd(padapter, &pmlmepriv->assoc_ssid);
 		return true;
-	} else {
-		int ret;
+	}
+	int ret;

-		ret = r8712_select_and_join_from_scan(pmlmepriv);
-		if (ret == _SUCCESS)
-			_set_timer(&pmlmepriv->assoc_timer, MAX_JOIN_TIMEOUT);
-		else {
-			if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) {
-				/* submit r8712_createbss_cmd to change to an
-				 * ADHOC_MASTER pmlmepriv->lock has been
-				 * acquired by caller...
-				 */
-				struct wlan_bssid_ex *pdev_network =
-					&(padapter->registrypriv.dev_network);
-				pmlmepriv->fw_state = WIFI_ADHOC_MASTER_STATE;
-				pibss = padapter->registrypriv.dev_network.
-					MacAddress;
-				memcpy(&pdev_network->Ssid,
-					&pmlmepriv->assoc_ssid,
-					sizeof(struct ndis_802_11_ssid));
-				r8712_update_registrypriv_dev_network(padapter);
-				r8712_generate_random_ibss(pibss);
-				if (r8712_createbss_cmd(padapter) != _SUCCESS)
-					return false;
-				pmlmepriv->to_join = false;
-			} else {
-				/* can't associate ; reset under-linking */
-				if (pmlmepriv->fw_state & _FW_UNDER_LINKING)
-					pmlmepriv->fw_state ^=
-							     _FW_UNDER_LINKING;
-				/* when set_ssid/set_bssid for do_join(), but
-				 * there are no desired bss in scanning queue
-				 * we try to issue sitesurvey first
-				 */
-				if (!pmlmepriv->sitesurveyctrl.traffic_busy)
-					r8712_sitesurvey_cmd(padapter,
-						       &pmlmepriv->assoc_ssid);
-			}
+	ret = r8712_select_and_join_from_scan(pmlmepriv);
+	if (ret == _SUCCESS)
+		_set_timer(&pmlmepriv->assoc_timer, MAX_JOIN_TIMEOUT);
+	else {
+		if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) {
+			/* submit r8712_createbss_cmd to change to an
+			 * ADHOC_MASTER pmlmepriv->lock has been
+			 * acquired by caller...
+			 */
+			struct wlan_bssid_ex *pdev_network =
+				&(padapter->registrypriv.dev_network);
+			pmlmepriv->fw_state = WIFI_ADHOC_MASTER_STATE;
+			pibss = padapter->registrypriv.dev_network.
+				MacAddress;
+			memcpy(&pdev_network->Ssid,
+				&pmlmepriv->assoc_ssid,
+				sizeof(struct ndis_802_11_ssid));
+			r8712_update_registrypriv_dev_network(padapter);
+			r8712_generate_random_ibss(pibss);
+			if (r8712_createbss_cmd(padapter) != _SUCCESS)
+				return false;
+			pmlmepriv->to_join = false;
+		} else {
+			/* can't associate ; reset under-linking */
+			if (pmlmepriv->fw_state & _FW_UNDER_LINKING)
+				pmlmepriv->fw_state ^=
+						     _FW_UNDER_LINKING;
+			/* when set_ssid/set_bssid for do_join(), but
+			 * there are no desired bss in scanning queue
+			 * we try to issue sitesurvey first
+			 */
+			if (!pmlmepriv->sitesurveyctrl.traffic_busy)
+				r8712_sitesurvey_cmd(padapter,
+					       &pmlmepriv->assoc_ssid);
 		}
 	}
 	return true;
diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index 7b7fdec..381e2da 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -483,8 +483,7 @@  static int is_desired_network(struct _adapter *adapter,
 		    pnetwork->network.IELength, wps_ie,
 		    &wps_ielen) == true)
 			return true;
-		else
-			return false;
+		return false;
 	}
 	if ((psecuritypriv->PrivacyAlgrthm != _NO_PRIVACY_) &&
 		    (pnetwork->network.Privacy == 0))
@@ -1356,8 +1355,7 @@  static int SecIsInPMKIDList(struct _adapter *Adapter, u8 *bssid)
 		   (!memcmp(psecuritypriv->PMKIDList[i].Bssid,
 			    bssid, ETH_ALEN)))
 			break;
-		else
-			i++;
+		i++;
 	} while (i < NUM_PMKID_CACHE);

 	if (i == NUM_PMKID_CACHE) {
@@ -1603,8 +1601,7 @@  sint r8712_restruct_sec_ie(struct _adapter *adapter, u8 *in_ie,
 	iEntry = SecIsInPMKIDList(adapter, pmlmepriv->assoc_bssid);
 	if (iEntry < 0)
 		return ielength;
-	else {
-		if (authmode == _WPA2_IE_ID_) {
+	else if (authmode == _WPA2_IE_ID_) {
 			out_ie[ielength] = 1;
 			ielength++;
 			out_ie[ielength] = 0;	/*PMKID count = 0x0100*/
@@ -1613,7 +1610,6 @@  sint r8712_restruct_sec_ie(struct _adapter *adapter, u8 *in_ie,
 				&psecuritypriv->PMKIDList[iEntry].PMKID, 16);
 			ielength += 16;
 			out_ie[13] += 18;/*PMKID length = 2+16*/
-		}
 	}
 	return ielength;
 }
diff --git a/drivers/staging/rtl8712/wifi.h b/drivers/staging/rtl8712/wifi.h
index 73d7cd2..f111ad3 100644
--- a/drivers/staging/rtl8712/wifi.h
+++ b/drivers/staging/rtl8712/wifi.h
@@ -331,8 +331,7 @@  static inline int IS_MCAST(unsigned char *da)
 {
 	if ((*da) & 0x01)
 		return true;
-	else
-		return false;
+	return false;
 }


diff --git a/drivers/staging/rtl8712/xmit_linux.c b/drivers/staging/rtl8712/xmit_linux.c
index 0ac9130..7dbecbb 100644
--- a/drivers/staging/rtl8712/xmit_linux.c
+++ b/drivers/staging/rtl8712/xmit_linux.c
@@ -72,8 +72,7 @@  sint r8712_endofpktfile(struct pkt_file *pfile)
 {
 	if (pfile->pkt_len == 0)
 		return true;
-	else
-		return false;
+	return false;
 }