Skip to contentSkip to conversation

staging: rtl8192u: remove return from end of void function

PATCH In review Supriya Karanth 2 participants 3 messages Mar 15, 2015 – Mar 19, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8192u: remove return from end of void function

This patch removes the return statement at the end of a void function as it is not necessary.

found by checkpatch.pl: WARNING: void function return statements are not generally useful

changes made using coccinelle script:

@@
@@

... when != if (...) return;
    when != if (...) { ... return;}

-return;

---
 drivers/staging/rtl8192u/r8192U_core.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/staging/rtl8192u/r8192U_core.c +0 -5
index 8f7a321..6f89939 100644
@@ -827,7 +827,6 @@ void rtl8192_rtx_disable(struct net_device *dev)
 		netdev_warn(dev, "skb_queue not empty\n");
 
 	skb_queue_purge(&priv->skb_queue);
-	return;
 }
 
 inline u16 ieeerate2rtlrate(int rate)
@@ -966,8 +965,6 @@ static void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev,
 	ret = rtl8192_tx(dev, skb);
 
 	spin_unlock_irqrestore(&priv->tx_lock, flags);
-
-	return;
 }
 
 /* This is a rough attempt to TX a frame
@@ -2067,7 +2064,6 @@ static void rtl8192_refresh_supportrate(struct r8192_priv *priv)
 		memcpy(ieee->Regdot11HTOperationalRateSet, ieee->RegHTSuppRateSet, 16);
 	else
 		memset(ieee->Regdot11HTOperationalRateSet, 0, 16);
-	return;
 }
 
 static u8 rtl8192_getSupportedWireleeMode(struct net_device *dev)
@@ -2507,7 +2503,6 @@ static void rtl8192_read_eeprom_info(struct net_device *dev)
 	//we need init DIG RATR table here again.
 
 	RT_TRACE(COMP_EPROM, "<===========%s()\n", __func__);
-	return;
 }
 
 static short rtl8192_get_channel_map(struct net_device *dev)
Signature · 1 line
2.1.0
#1 lore raw
Quoted 6 lines · Supriya Karanth

This patch removes the return statement at the end of a void function as it is not necessary.

found by checkpatch.pl: WARNING: void function return statements are not generally useful

Quoted 8 lines

changes made using coccinelle script:

@@
@@

... when != if (...) return;
    when != if (...) { ... return;}

-return;

You can try

@@
expression e;
@@

... when != true e
- return;

You will still get false positives in loops and switces, but this should let you get more results. The != true means that you don't go through th then branch of an if, ie no expression is ever considred to be true.

julia

Quoted 53 lines
---
 drivers/staging/rtl8192u/r8192U_core.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/staging/rtl8192u/r8192U_core.c +0 -5
index 8f7a321..6f89939 100644
@@ -827,7 +827,6 @@ void rtl8192_rtx_disable(struct net_device *dev)
 		netdev_warn(dev, "skb_queue not empty\n");
 
 	skb_queue_purge(&priv->skb_queue);
-	return;
 }
 
 inline u16 ieeerate2rtlrate(int rate)
@@ -966,8 +965,6 @@ static void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev,
 	ret = rtl8192_tx(dev, skb);
 
 	spin_unlock_irqrestore(&priv->tx_lock, flags);
-
-	return;
 }
 
 /* This is a rough attempt to TX a frame
@@ -2067,7 +2064,6 @@ static void rtl8192_refresh_supportrate(struct r8192_priv *priv)
 		memcpy(ieee->Regdot11HTOperationalRateSet, ieee->RegHTSuppRateSet, 16);
 	else
 		memset(ieee->Regdot11HTOperationalRateSet, 0, 16);
-	return;
 }
 
 static u8 rtl8192_getSupportedWireleeMode(struct net_device *dev)
@@ -2507,7 +2503,6 @@ static void rtl8192_read_eeprom_info(struct net_device *dev)
 	//we need init DIG RATR table here again.
 
 	RT_TRACE(COMP_EPROM, "<===========%s()\n", __func__);
-	return;
 }
 
 static short rtl8192_get_channel_map(struct net_device *dev)
Signature · 8 lines
2.1.0

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1426390972-31372-1-git-send-email-iskaranth%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
#2 lore raw
Quoted 25 lines · Julia Lawall
Quoted 6 lines · Supriya Karanth

This patch removes the return statement at the end of a void function as it is not necessary.

found by checkpatch.pl: WARNING: void function return statements are not generally useful

Quoted 8 lines

changes made using coccinelle script:

@@
@@

... when != if (...) return;
    when != if (...) { ... return;}

-return;

You can try

@@
expression e;
@@

Quoted 10 lines

... when != true e
- return;

You will still get false positives in loops and switces, but this should let you get more results. The != true means that you don't go through th then branch of an if, ie no expression is ever considred to be true.

julia

OK, I didn't realize it was that simple.

It is not working on this file though and I am not able to understand why? drivers/staging/lustre/lustre/libcfs/workitem.c

There are 2 void functions with return cfs_wi_exit & cfs_wi_schedule and the script doesn't change it.

Quoted 20 lines
Quoted 20 lines

static u8 rtl8192_getSupportedWireleeMode(struct net_device *dev)

drivers/staging/rtl8192u/r8192U_core.c +0 -1
@@ -2507,7 +2503,6 @@ static void rtl8192_read_eeprom_info(struct net_device *dev)
 	//we need init DIG RATR table here again.
 
 	RT_TRACE(COMP_EPROM, "<===========%s()\n", __func__);
-	return;
 }
 
 static short rtl8192_get_channel_map(struct net_device *dev)
Signature · 8 lines
2.1.0

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1426390972-31372-1-git-send-email-iskaranth%40gmail.com.
For more options, visit https://groups.google.com/d/optout.