staging: ks7010: ks_wlan_net: Remove unnecessary variable used to store return value
PATCH 1/1 staging: ks7010: ks_wlan_net: Remove unnecessary variable used to store return value
Remove unneeded variable used to store return values. The reason is to reduce the memory usage. Done using returnvar.cocci script.
--- drivers/staging/ks7010/ks_wlan_net.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/ks7010/ks_wlan_net.c +1 -2
@@ -3507,12 +3507,11 @@ int ks_wlan_net_stop(struct net_device *dev) {struct ks_wlan_private *priv =netdev_priv (dev); -int ret =0 ; priv->device_open_status =0 ;del_timer_sync (&update_phyinfo_timer);if (netif_running (dev))netif_stop_queue (dev); -return ret; +return 0 ; }
Signature · 1 line
2.7.4
Quoted 2 lines · Georgiana Rodica Chelu
Remove unneeded variable used to store return values. The reason is to reduce the memory usage.
I don't think that it would have any impact on the memory usage. The compiler should be clever enough to produce the same code in both cases, since ret isn't used anywhere else in the function.
But the change makes the function shorter, so there is less noise to look at, and it makes it completely obvious that the only possible return value is 0 (success).
julia
Quoted 35 lines
Done using
returnvar.cocciscript.Signed-off-by Georgiana Rodica Chelu <[email protected]>--- drivers/staging/ks7010/ks_wlan_net.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/staging/ks7010/ks_wlan_net.c +1
-3@@ -3507,12 +3507,11 @@ int ks_wlan_net_stop(struct net_device *dev) {struct ks_wlan_private *priv =netdev_priv (dev); -int ret =0 ; priv->device_open_status =0 ;del_timer_sync (&update_phyinfo_timer);if (netif_running (dev))netif_stop_queue (dev); -return ret; +return 0 ; } --2.7.4
--
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/20160923191425.GA6587%40fireworks.
For more options, visit https://groups.google.com/d/optout.
I think you are perfectly right, thank you. I will submit the second version right now.
Georgiana
Quoted 57 lines · Julia Lawall
Quoted 2 lines · Georgiana Rodica Chelu
Remove unneeded variable used to store return values. The reason is to reduce the memory usage.
I don't think that it would have any impact on the memory usage. The compiler should be clever enough to produce the same code in both cases, since ret isn't used anywhere else in the function.
But the change makes the function shorter, so there is less noise to look at, and it makes it completely obvious that the only possible return value is 0 (success).
julia
Review
Quoted 8 lines
Done using
returnvar.cocciscript.Signed-off-by Georgiana Rodica Chelu <[email protected]>--- drivers/staging/ks7010/ks_wlan_net.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/staging/ks7010/ks_wlan_net.cQuoted 20 lines
index f1cd90e..d13a06b 100644
drivers/staging/ks7010/ks_wlan_net.c +1
-3@@ -3507,12 +3507,11 @@ int ks_wlan_net_stop(struct net_device *dev) {struct ks_wlan_private *priv =netdev_priv (dev); -int ret =0 ; priv->device_open_status =0 ;del_timer_sync (&update_phyinfo_timer);if (netif_running (dev))netif_stop_queue (dev); -return ret; +return 0 ; } --2.7.4
Quoted 2 lines
--
You received this message because you are subscribed to the GoogleGroups "outreachy-kernel" group.
Quoted 1 line
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected].
Quoted 2 lines
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/20160923191425.GA6587%40fireworks.
Quoted 2 lines
For more options, visit https://groups.google.com/d/optout.