• Gustavo A. R. Silva's avatar
    media: s5k5baf: remove unnecessary static in s5k5baf_get_selection() · 281643a2
    Gustavo A. R. Silva authored
    Remove unnecessary static on local variable rtype. Such variable
    is initialized before being used, on every execution path throughout
    the function. The static has no benefit and, removing it reduces
    the code 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 the difference in the code 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
      27765    5656     320   33741    83cd drivers/media/i2c/s5k5baf.o
    
    after:
       text    data     bss     dec     hex filename
      27733    5600     256   33589    8335 drivers/media/i2c/s5k5baf.o
    Signed-off-by: default avatarGustavo A. R. Silva <garsilva@embeddedor.com>
    Reviewed-by: default avatarAndrzej Hajda <a.hajda@samsung.com>
    Signed-off-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
    281643a2
s5k5baf.c 50.4 KB