]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
liquidio: lio_main: remove unnecessary static in setup_io_queues()
authorGustavo A. R. Silva <gustavo@embeddedor.com>
Tue, 18 Jul 2017 20:53:48 +0000 (15:53 -0500)
committerDavid S. Miller <davem@davemloft.net>
Wed, 19 Jul 2017 23:33:57 +0000 (16:33 -0700)
Remove unnecessary static on local variables cpu_id_modulus and cpu_id.
Such variables are initialized before being used, on every execution
path throughout the function. The static has no benefit and, removing
it reduces the object file size.

This issue was detected using Coccinelle and the following semantic patch:

@bad exists@
position p;
identifier x;
type T;
@@

static T x@p;
...
x = <+...x...+>

@@
identifier x;
expression e;
type T;
position p != bad.p;
@@

-static
 T x@p;
 ... when != x
     when strict
?x = e;

In the following log you can see a significant difference in the object
file size. Also, there is a significant difference in the bss segment.
This log is the output of the size command, before and after the code
change:

before:
   text    data     bss     dec     hex filename
  78689   15272   27808  121769   1dba9 drivers/net/ethernet/cavium/liquidio/lio_main.o

after:
   text    data     bss     dec     hex filename
  78667   15128   27680  121475   1da83 drivers/net/ethernet/cavium/liquidio/lio_main.o

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Acked-by: Felix Manlunas <felix.manlunas@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/cavium/liquidio/lio_main.c

index 51583ae4b1ebe6e6d441cf3a3d073702ac35e808..1d8fefa9ce6477cfe07db64fb71ce9b720c93cce 100644 (file)
@@ -2544,8 +2544,8 @@ static inline int setup_io_queues(struct octeon_device *octeon_dev,
 {
        struct octeon_droq_ops droq_ops;
        struct net_device *netdev;
-       static int cpu_id;
-       static int cpu_id_modulus;
+       int cpu_id;
+       int cpu_id_modulus;
        struct octeon_droq *droq;
        struct napi_struct *napi;
        int q, q_no, retval = 0;