diff mbox

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

Message ID 20140921001059.GA3696@Tapasweni.Pathak
State New, archived
Headers show

Commit Message

Tapasweni Pathak Sept. 21, 2014, 12:10 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/hal_init.c      |    6 +---
 drivers/staging/rtl8712/ieee80211.c     |   17 ++++++-------
 drivers/staging/rtl8712/osdep_service.h |    6 +---
 drivers/staging/rtl8712/rtl8712_efuse.c |   39 +++++++++++++++----------------
 4 files changed, 31 insertions(+), 37 deletions(-)

--
1.7.0.4

Comments

'Greg KH' Sept. 23, 2014, 3:08 p.m. UTC | #1
On Sun, Sep 21, 2014 at 05:40:59AM +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/hal_init.c      |    6 +---
>  drivers/staging/rtl8712/ieee80211.c     |   17 ++++++-------
>  drivers/staging/rtl8712/osdep_service.h |    6 +---
>  drivers/staging/rtl8712/rtl8712_efuse.c |   39 +++++++++++++++----------------
>  4 files changed, 31 insertions(+), 37 deletions(-)

this patch breaks the build :(

_Always_ test build your patches, don't let others have to find these
kinds of errors for you, it's not good and makes maintainers grumpy :)

thanks,

greg k-h
diff mbox

Patch

diff --git a/drivers/staging/rtl8712/hal_init.c b/drivers/staging/rtl8712/hal_init.c
index 81cd654..5c5e295 100644
--- a/drivers/staging/rtl8712/hal_init.c
+++ b/drivers/staging/rtl8712/hal_init.c
@@ -389,10 +389,8 @@  uint rtl871x_hal_init(struct _adapter *padapter)
 	padapter->hw_init_completed = false;
 	if (padapter->halpriv.hal_bus_init == NULL)
 		return _FAIL;
-	else {
-		if (padapter->halpriv.hal_bus_init(padapter) != _SUCCESS)
-			return _FAIL;
-	}
+	else if (padapter->halpriv.hal_bus_init(padapter) != _SUCCESS)
+		return _FAIL;
 	if (rtl8712_hal_init(padapter) == _SUCCESS)
 		padapter->hw_init_completed = true;
 	else {
diff --git a/drivers/staging/rtl8712/ieee80211.c b/drivers/staging/rtl8712/ieee80211.c
index fe9459e..0d81497 100644
--- a/drivers/staging/rtl8712/ieee80211.c
+++ b/drivers/staging/rtl8712/ieee80211.c
@@ -124,11 +124,10 @@  u8 *r8712_get_ie(u8 *pbuf, sint index, sint *len, sint limit)
 		if (*p == index) {
 			*len = *(p + 1);
 			return p;
-		} else {
-			tmp = *(p + 1);
-			p += (tmp + 2);
-			i += (tmp + 2);
 		}
+		tmp = *(p + 1);
+		p += (tmp + 2);
+		i += (tmp + 2);
 		if (i >= limit)
 			break;
 	}
@@ -237,9 +236,9 @@  unsigned char *r8712_get_wpa_ie(unsigned char *pie, int *wpa_ie_len, int limit)
 				goto check_next_ie;
 			*wpa_ie_len = *(pbuf + 1);
 			return pbuf;
-		} else {
-			*wpa_ie_len = 0;
-			return NULL;
+		}
+		*wpa_ie_len = 0;
+		return NULL;
 		}
 check_next_ie:
 		limit = limit - (pbuf - pie) - 2 - len;
@@ -414,8 +413,8 @@  int r8712_get_wps_ie(u8 *in_ie, uint in_len, u8 *wps_ie, uint *wps_ielen)
 			cnt += in_ie[cnt+1]+2;
 			match = true;
 			break;
-		} else
-			cnt += in_ie[cnt+1]+2; /* goto next */
+		}
+		cnt += in_ie[cnt+1]+2; /* goto next */
 	}
 	return match;
 }
diff --git a/drivers/staging/rtl8712/osdep_service.h b/drivers/staging/rtl8712/osdep_service.h
index d7a357b..3a15084 100644
--- a/drivers/staging/rtl8712/osdep_service.h
+++ b/drivers/staging/rtl8712/osdep_service.h
@@ -88,8 +88,7 @@  static inline u32 _down_sema(struct semaphore *sema)
 {
 	if (down_interruptible(sema))
 		return _FAIL;
-	else
-		return _SUCCESS;
+	return _SUCCESS;
 }

 static inline u32 end_of_queue_search(struct list_head *head,
@@ -97,8 +96,7 @@  static inline u32 end_of_queue_search(struct list_head *head,
 {
 	if (head == plist)
 		return true;
-	else
-		return false;
+	return false;
 }

 static inline void sleep_schedulable(int ms)
diff --git a/drivers/staging/rtl8712/rtl8712_efuse.c b/drivers/staging/rtl8712/rtl8712_efuse.c
index c9eeb42..2b6abdf 100644
--- a/drivers/staging/rtl8712/rtl8712_efuse.c
+++ b/drivers/staging/rtl8712/rtl8712_efuse.c
@@ -414,19 +414,19 @@  u8 r8712_efuse_pg_packet_write(struct _adapter *padapter, const u8 offset,
 					bResult = false;
 			}
 			break;
-		} else { /* write header fail */
-			bResult = false;
-			if (0xFF == efuse_data)
-				return bResult; /* nothing damaged. */
-			/* call rescue procedure */
-			if (fix_header(padapter, efuse_data, efuse_addr) ==
-			    false)
-				return false; /* rescue fail */
-
-			if (++repeat_times > _REPEAT_THRESHOLD_) /* fail */
-				break;
-			/* otherwise, take another risk... */
 		}
+		/* write header fail */
+		bResult = false;
+		if (0xFF == efuse_data)
+			return bResult; /* nothing damaged. */
+		/* call rescue procedure */
+		if (fix_header(padapter, efuse_data, efuse_addr) ==
+		    false)
+			return false; /* rescue fail */
+
+		if (++repeat_times > _REPEAT_THRESHOLD_) /* fail */
+			break;
+		/* otherwise, take another risk... */
 	}
 	return bResult;
 }
@@ -541,15 +541,14 @@  u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr, u16 cnts,
 				}
 				idx++;
 				break;
-			} else {
-				if ((data[idx] != pktdata[i]) || (data[idx+1] !=
-				     pktdata[i+1])) {
-					word_en &= ~BIT(i >> 1);
-					newdata[j++] = data[idx];
-					newdata[j++] = data[idx + 1];
-				}
-				idx += 2;
 			}
+			if ((data[idx] != pktdata[i]) || (data[idx+1] !=
+						pktdata[i+1])) {
+				word_en &= ~BIT(i >> 1);
+				newdata[j++] = data[idx];
+				newdata[j++] = data[idx + 1];
+			}
+			idx += 2;
 			if (idx == cnts)
 				break;
 		}