ibm_rtl: remove unnecessary static in ibm_rtl_write()
PATCH 1/1 ibm_rtl: remove unnecessary static in ibm_rtl_write()
Remove unnecessary static on local variable cmd_port_val. Such variable is 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:
https://github.com/GustavoARSilva/coccinelle/blob/master/static/static_unused.cocci
In the following log you can see a difference in the object file size. This log is the output of the size command, before and after the code change:
before:
text data bss dec hex filename 3932 3440 512 7884 1ecc drivers/platform/x86/ibm_rtl.o
after:
text data bss dec hex filename 3887 3384 448 7719 1e27 drivers/platform/x86/ibm_rtl.o
--- drivers/platform/x86/ibm_rtl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/ibm_rtl.c +1 -1
@@ -103,7 +103,7 @@ static void rtl_port_unmap(void __iomem *addr)static int ibm_rtl_write (u8 value) {int ret =0 , count =0 ; -static u32 cmd_port_val; +u32 cmd_port_val;RTL_DEBUG ("%s(%d)\n" , __func__, value);
Signature · 1 line
2.5.0
Quoted 12 lines · Gustavo A. R. Silva
Remove unnecessary static on local variable
cmd_port_val. Such variable is 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:
https://github.com/GustavoARSilva/coccinelle/blob/master/static/static_unused.cocciIn the following log you can see a difference in the object file size. This log is the output of the size command, before and after the code change:
Quoted 8 lines
before:
text data bss dec hex filename
3932 3440 512 7884 1eccdrivers/platform/x86/ibm_rtl.oafter:
text data bss dec hex filename 3887 3384 448 7719 1e27 drivers/platform/x86/ibm_rtl.o
Pushed to testing, thanks,
Quoted 21 lines
Signed-off-by Gustavo A. R. Silva <[email protected]>--- drivers/platform/x86/ibm_rtl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/platform/x86/ibm_rtl.c +1
-2@@ -103,7 +103,7 @@ static void rtl_port_unmap(void __iomem *addr)static int ibm_rtl_write (u8 value) {int ret =0 , count =0 ; -static u32 cmd_port_val; +u32 cmd_port_val;RTL_DEBUG ("%s(%d)\n" , __func__, value); --2.5.0
Signature · 2 lines
With Best Regards, Andy Shevchenko