* [PATCH] staging: ks7010: ks_wlan_net: Remove unnecessary variable used to store return value
@ 2016-09-23 19:14 Georgiana Rodica Chelu
2016-09-23 19:27 ` [Outreachy kernel] " Julia Lawall
0 siblings, 1 reply; 3+ messages in thread
From: Georgiana Rodica Chelu @ 2016-09-23 19:14 UTC (permalink / raw)
To: outreachy-kernel; +Cc: gregkh
Remove unneeded variable used to store return values.
The reason is to reduce the memory usage.
Done using returnvar.cocci script.
Signed-off-by: Georgiana Rodica Chelu <georgiana.chelu93@gmail.com>
---
drivers/staging/ks7010/ks_wlan_net.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
index f1cd90e..d13a06b 100644
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ b/drivers/staging/ks7010/ks_wlan_net.c
@@ -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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Outreachy kernel] [PATCH] staging: ks7010: ks_wlan_net: Remove unnecessary variable used to store return value
2016-09-23 19:14 [PATCH] staging: ks7010: ks_wlan_net: Remove unnecessary variable used to store return value Georgiana Rodica Chelu
@ 2016-09-23 19:27 ` Julia Lawall
2016-09-23 19:43 ` Georgiana Chelu
0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2016-09-23 19:27 UTC (permalink / raw)
To: Georgiana Rodica Chelu; +Cc: outreachy-kernel, gregkh
On Fri, 23 Sep 2016, Georgiana Rodica Chelu wrote:
> 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
> Done using returnvar.cocci script.
>
> Signed-off-by: Georgiana Rodica Chelu <georgiana.chelu93@gmail.com>
> ---
> drivers/staging/ks7010/ks_wlan_net.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
> index f1cd90e..d13a06b 100644
> --- a/drivers/staging/ks7010/ks_wlan_net.c
> +++ b/drivers/staging/ks7010/ks_wlan_net.c
> @@ -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 outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> 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.
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Outreachy kernel] [PATCH] staging: ks7010: ks_wlan_net: Remove unnecessary variable used to store return value
2016-09-23 19:27 ` [Outreachy kernel] " Julia Lawall
@ 2016-09-23 19:43 ` Georgiana Chelu
0 siblings, 0 replies; 3+ messages in thread
From: Georgiana Chelu @ 2016-09-23 19:43 UTC (permalink / raw)
To: Julia Lawall; +Cc: outreachy-kernel, Greg Kroah-Hartman
[-- Attachment #1: Type: text/plain, Size: 2115 bytes --]
I think you are perfectly right, thank you. I will submit the second
version right now.
Georgiana
On 23 September 2016 at 22:27, Julia Lawall <julia.lawall@lip6.fr> wrote:
>
>
> On Fri, 23 Sep 2016, Georgiana Rodica Chelu wrote:
>
> > 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
>
> > Done using returnvar.cocci script.
> >
> > Signed-off-by: Georgiana Rodica Chelu <georgiana.chelu93@gmail.com>
> > ---
> > drivers/staging/ks7010/ks_wlan_net.c | 3 +--
> > 1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/drivers/staging/ks7010/ks_wlan_net.c
> b/drivers/staging/ks7010/ks_wlan_net.c
> > index f1cd90e..d13a06b 100644
> > --- a/drivers/staging/ks7010/ks_wlan_net.c
> > +++ b/drivers/staging/ks7010/ks_wlan_net.c
> > @@ -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 outreachy-kernel+unsubscribe@googlegroups.com.
> > To post to this group, send email to outreachy-kernel@googlegroups.com.
> > 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.
> >
>
[-- Attachment #2: Type: text/html, Size: 3337 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-09-23 19:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-23 19:14 [PATCH] staging: ks7010: ks_wlan_net: Remove unnecessary variable used to store return value Georgiana Rodica Chelu
2016-09-23 19:27 ` [Outreachy kernel] " Julia Lawall
2016-09-23 19:43 ` Georgiana Chelu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.