Skip to contentSkip to conversation

Staging: rtl8712 removed unnecessary else after return

PATCH Superseded Nitin Kuppelur 4 participants 10 messages Oct 1, 2014 – Oct 9, 2014 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: rtl8712 removed unnecessary else after return

Removed unnecessary else after return to solve
checkpatch.pl warning

---
 drivers/staging/rtl8712/hal_init.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/rtl8712/hal_init.c +2 -4
index 81cd654..1d6ade0 100644
@@ -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;
-	}
+	if (padapter->halpriv.hal_bus_init(padapter) != _SUCCESS)
+		return _FAIL;
 	if (rtl8712_hal_init(padapter) == _SUCCESS)
 		padapter->hw_init_completed = true;
 	else {
Signature · 1 line
1.9.1
#1 lore raw
Quoted 2 lines · Nitin Kuppelur

Removed unnecessary else after return to solve
checkpatch.pl warning

[]

drivers/staging/rtl8712/hal_init.c

Quoted 1 line
drivers/staging/rtl8712/hal_init.c +0 -0

[]

drivers/staging/rtl8712/hal_init.c uint rtl871x_hal_init(struct _adapter *padapter) · line 393

Quoted 10 lines
drivers/staging/rtl8712/hal_init.c +2 -4
@@ -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;
-	}
+	if (padapter->halpriv.hal_bus_init(padapter) != _SUCCESS)
+		return _FAIL;

Perhaps a more common style is to use:

	if (!padapter->halpriv.hal_bus_init ||
	    padapter->halpriv.hal_bus_init(padapter) != _SUCCESS)
		return _FAIL;
#2 lore raw
Quoted 8 lines

Perhaps a more common style is to use:

	if (!padapter->halpriv.hal_bus_init ||
	    padapter->halpriv.hal_bus_init(padapter) != _SUCCESS)
		return _FAIL;

Agreed. I will send updated patch.

Regards,
Nitin

#3 lore raw

PATCH v2 1/1 Staging: rtl8712 removed unnecessary else after return

Removed unnecessary else after return to solve
checkpatch.pl warning

---
 drivers/staging/rtl8712/hal_init.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/staging/rtl8712/hal_init.c +2 -5
index 81cd654..e5878e2 100644
@@ -387,12 +387,9 @@ uint rtl8712_hal_deinit(struct _adapter *padapter)
 uint rtl871x_hal_init(struct _adapter *padapter)
 {
 	padapter->hw_init_completed = false;
-	if (padapter->halpriv.hal_bus_init == NULL)
+	if (padapter->halpriv.hal_bus_init == NULL ||
+		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 {
Signature · 1 line
1.9.1
#4 lore raw
Quoted 13 lines · Nitin Kuppelur

Removed unnecessary else after return to solve
checkpatch.pl warning

---
 drivers/staging/rtl8712/hal_init.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/staging/rtl8712/hal_init.c +0 -0
index 81cd654..e5878e2 100644

drivers/staging/rtl8712/hal_init.c uint rtl8712_hal_deinit(struct _adapter *padapter) · line 392

Quoted 7 lines
drivers/staging/rtl8712/hal_init.c +2 -1
@@ -387,12 +387,9 @@ uint rtl8712_hal_deinit(struct _adapter *padapter)
 uint rtl871x_hal_init(struct _adapter *padapter)
 {
 	padapter->hw_init_completed = false;
-	if (padapter->halpriv.hal_bus_init == NULL)
+	if (padapter->halpriv.hal_bus_init == NULL ||
+		padapter->halpriv.hal_bus_init(padapter) != _SUCCESS)
 		return _FAIL;

Align these like this:

	if (padapter->halpriv.hal_bus_init == NULL ||
	    padapter->halpriv.hal_bus_init(padapter) != _SUCCESS) 
		return _FAIL;

[tab][space][space][space][space]padapter->halpriv.hal_bus_init...

regards,
dan carpenter

#5 lore raw

PATCH 1/1 Staging: rtl8712 removed unnecessary else after return

Removed unnecessary else after return to solve
checkpatch.pl warning

---
 drivers/staging/rtl8712/hal_init.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/staging/rtl8712/hal_init.c +2 -5
index 81cd654..fbaba11 100644
@@ -387,12 +387,9 @@ uint rtl8712_hal_deinit(struct _adapter *padapter)
 uint rtl871x_hal_init(struct _adapter *padapter)
 {
 	padapter->hw_init_completed = false;
-	if (padapter->halpriv.hal_bus_init == NULL)
+	if (padapter->halpriv.hal_bus_init == NULL ||
+	    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 {
Signature · 1 line
1.9.1
#6 lore raw

PATCH v3 1/1 Staging: rtl8712 removed unnecessary else after return

In reply to Dan Carpenter

Removed unnecessary else after return to solve
checkpatch.pl warning

---
 drivers/staging/rtl8712/hal_init.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/staging/rtl8712/hal_init.c +2 -5
index 81cd654..fbaba11 100644
@@ -387,12 +387,9 @@ uint rtl8712_hal_deinit(struct _adapter *padapter)
 uint rtl871x_hal_init(struct _adapter *padapter)
 {
 	padapter->hw_init_completed = false;
-	if (padapter->halpriv.hal_bus_init == NULL)
+	if (padapter->halpriv.hal_bus_init == NULL ||
+	    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 {
Signature · 1 line
1.9.1
maintainer
#7 lore raw
Quoted 17 lines · Nitin Kuppelur

Removed unnecessary else after return to solve
checkpatch.pl warning

---
 drivers/staging/rtl8712/hal_init.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/staging/rtl8712/hal_init.c +0 -1
index 81cd654..fbaba11 100644
@@ -387,12 +387,9 @@ uint rtl8712_hal_deinit(struct _adapter *padapter)
 uint rtl871x_hal_init(struct _adapter *padapter)
 {
 	padapter->hw_init_completed = false;
-	if (padapter->halpriv.hal_bus_init == NULL)

drivers/staging/rtl8712/hal_init.c uint rtl8712_hal_deinit(struct _adapter *padapter) · line 395

Quoted 10 lines
drivers/staging/rtl8712/hal_init.c +2 -4
+	if (padapter->halpriv.hal_bus_init == NULL ||
+	    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 {

This doesn't apply to my tree :(

#8 lore raw

Hi Greg,

Sorry for noob question. I am still new to Kernel development.

I understood from your comment that the patch did not apply cleanly to your tree (may be due to change in the code which I have modified)

But what should I do after this?
1) Send patch on rebased file to same mail chain with (--in-reply-to) and [PATCH V4] ? OR
2) Create new PATCH and start new mail chain done on latest code.

Regards,
Nitin

Quoted 30 lines · Greg KH
Quoted 17 lines · Nitin Kuppelur

Removed unnecessary else after return to solve
checkpatch.pl warning

---
 drivers/staging/rtl8712/hal_init.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/staging/rtl8712/hal_init.c +0 -1
index 81cd654..fbaba11 100644
@@ -387,12 +387,9 @@ uint rtl8712_hal_deinit(struct _adapter *padapter)
 uint rtl871x_hal_init(struct _adapter *padapter)
 {
      padapter->hw_init_completed = false;
-     if (padapter->halpriv.hal_bus_init == NULL)

drivers/staging/rtl8712/hal_init.c uint rtl8712_hal_deinit(struct _adapter *padapter) · line 395

Quoted 10 lines
drivers/staging/rtl8712/hal_init.c +2 -4
+     if (padapter->halpriv.hal_bus_init == NULL ||
+         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 {

This doesn't apply to my tree :(

maintainer
#9 lore raw

A: No.
Q: Should I include quotations after my reply?

http://daringfireball.net/2007/07/on_top

Quoted 6 lines · Nitin Kuppelur

Hi Greg,

Sorry for noob question. I am still new to Kernel development.

I understood from your comment that the patch did not apply cleanly to your tree (may be due to change in the code which I have modified)

Or due to changes that others made and got accepted.

Quoted 4 lines

But what should I do after this?
1) Send patch on rebased file to same mail chain with (--in-reply-to) and [PATCH V4] ? OR
2) Create new PATCH and start new mail chain done on latest code.

Create a new patch and new email thread please.

thanks,

greg k-h