Skip to contentSkip to conversation

staging: rtl8188eu: replace goto with direct return

PATCH In review Deborah Brouwer 3 participants 4 messages Apr 4, 2021 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8188eu: replace goto with direct return

To conform with Linux kernel coding style, replace goto statement that does no cleanup with a direct return. To preserve meaning, copy comments from the original goto statement to the return statement. Identified by the checkpatch warning: WARNING: void function return statements are not generally useful.

---
 drivers/staging/rtl8188eu/hal/rtl8188e_dm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/rtl8188eu/hal/rtl8188e_dm.c +3 -3
index 391c59490718..d21f21857c20 100644
@@ -139,7 +139,9 @@ void rtw_hal_dm_watchdog(struct adapter *Adapter)
 	hw_init_completed = Adapter->hw_init_completed;
 
 	if (!hw_init_completed)
-		goto skip_dm;
+		/*  Check GPIO to determine current RF on/off and Pbc status. */
+		/*  Check Hardware Radio ON/OFF or not */
+		return;
 
 	/* ODM */
 	pmlmepriv = &Adapter->mlmepriv;
@@ -156,10 +158,8 @@ void rtw_hal_dm_watchdog(struct adapter *Adapter)
 
 	Adapter->HalData->odmpriv.bLinked = bLinked;
 	ODM_DMWatchdog(&Adapter->HalData->odmpriv);
-skip_dm:
 	/*  Check GPIO to determine current RF on/off and Pbc status. */
 	/*  Check Hardware Radio ON/OFF or not */
-	return;
 }
 
 void rtw_hal_dm_init(struct adapter *Adapter)
Signature · 1 line
2.17.1
#1 lore raw
Quoted 5 lines · Deborah Brouwer

To conform with Linux kernel coding style, replace goto statement that does no cleanup with a direct return. To preserve meaning, copy comments from the original goto statement to the return statement. Identified by the checkpatch warning: WARNING: void function return statements are not generally useful.

Maybe the comments are meant as TODO items?

julia

Quoted 40 lines
---
 drivers/staging/rtl8188eu/hal/rtl8188e_dm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/rtl8188eu/hal/rtl8188e_dm.c +3 -4
index 391c59490718..d21f21857c20 100644
@@ -139,7 +139,9 @@ void rtw_hal_dm_watchdog(struct adapter *Adapter)
 	hw_init_completed = Adapter->hw_init_completed;
 
 	if (!hw_init_completed)
-		goto skip_dm;
+		/*  Check GPIO to determine current RF on/off and Pbc status. */
+		/*  Check Hardware Radio ON/OFF or not */
+		return;
 
 	/* ODM */
 	pmlmepriv = &Adapter->mlmepriv;
@@ -156,10 +158,8 @@ void rtw_hal_dm_watchdog(struct adapter *Adapter)
 
 	Adapter->HalData->odmpriv.bLinked = bLinked;
 	ODM_DMWatchdog(&Adapter->HalData->odmpriv);
-skip_dm:
 	/*  Check GPIO to determine current RF on/off and Pbc status. */
 	/*  Check Hardware Radio ON/OFF or not */
-	return;
 }
 
 void rtw_hal_dm_init(struct adapter *Adapter)
--

2.17.1

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20210404054008.23525-1-deborahbrouwer3563%40gmail.com.

maintainer
#2 lore raw
In reply to Deborah Brouwer
Quoted 16 lines · Deborah Brouwer

To conform with Linux kernel coding style, replace goto statement that does no cleanup with a direct return. To preserve meaning, copy comments from the original goto statement to the return statement. Identified by the checkpatch warning: WARNING: void function return statements are not generally useful.

---
 drivers/staging/rtl8188eu/hal/rtl8188e_dm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/rtl8188eu/hal/rtl8188e_dm.c +0 -0
index 391c59490718..d21f21857c20 100644

drivers/staging/rtl8188eu/hal/rtl8188e_dm.c void rtw_hal_dm_watchdog(struct adapter *Adapter) · line 144

Quoted 7 lines
drivers/staging/rtl8188eu/hal/rtl8188e_dm.c +3 -1
@@ -139,7 +139,9 @@ void rtw_hal_dm_watchdog(struct adapter *Adapter)
 	hw_init_completed = Adapter->hw_init_completed;
 
 	if (!hw_init_completed)
-		goto skip_dm;
+		/*  Check GPIO to determine current RF on/off and Pbc status. */
+		/*  Check Hardware Radio ON/OFF or not */
+		return;

It does not make sense to have the comments in two places here. The original code is just fine, there's nothing wrong with the goto statement here.

thanks,

greg k-h

#3 lore raw
Quoted 29 lines · Greg KH
Quoted 16 lines · Deborah Brouwer

To conform with Linux kernel coding style, replace goto statement that does no cleanup with a direct return. To preserve meaning, copy comments from the original goto statement to the return statement. Identified by the checkpatch warning: WARNING: void function return statements are not generally useful.

---
 drivers/staging/rtl8188eu/hal/rtl8188e_dm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/rtl8188eu/hal/rtl8188e_dm.c +0 -0
index 391c59490718..d21f21857c20 100644

drivers/staging/rtl8188eu/hal/rtl8188e_dm.c void rtw_hal_dm_watchdog(struct adapter *Adapter) · line 144

Quoted 7 lines
drivers/staging/rtl8188eu/hal/rtl8188e_dm.c +3 -1
@@ -139,7 +139,9 @@ void rtw_hal_dm_watchdog(struct adapter *Adapter)
 	hw_init_completed = Adapter->hw_init_completed;
 
 	if (!hw_init_completed)
-		goto skip_dm;
+		/*  Check GPIO to determine current RF on/off and Pbc status. */
+		/*  Check Hardware Radio ON/OFF or not */
+		return;

It does not make sense to have the comments in two places here. The original code is just fine, there's nothing wrong with the goto statement here.

Quoted 3 lines

thanks,

greg k-h

Ok, thanks for this feedback.