bluetooth: btwilink: remove unnecessary static in bt_ti_probe()
PATCH 1/1 bluetooth: btwilink: remove unnecessary static in bt_ti_probe()
Remove unnecessary static on local variable hst. 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:
@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 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 4029 2528 128 6685 1a1d drivers/bluetooth/btwilink.o
after:
text data bss dec hex filename
4007 2472 64 6543 198f drivers/bluetooth/btwilink.o
--- drivers/bluetooth/btwilink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bluetooth/btwilink.c +1 -1
@@ -276,7 +276,7 @@ static int ti_st_send_frame(struct hci_dev *hdev, struct sk_buff *skb)static int bt_ti_probe (struct platform_device *pdev) { -static struct ti_st *hst; +struct ti_st *hst;struct hci_dev *hdev;int err;
Signature · 1 line
2.5.0
Marcel Holtmann
maintainerHi Gustavo,
Quoted 40 lines
Remove unnecessary static on local variable hst. 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:@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 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 4029 2528 128 6685 1a1d drivers/bluetooth/btwilink.o
Quoted 8 lines
after:
text data bss dec hex filename
4007 2472 64 6543 198fdrivers/bluetooth/btwilink.oSigned-off-by Gustavo A. R. Silva <[email protected]>---
drivers/bluetooth/btwilink.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel
Hi Marcel,
Quoted 46 lines · Marcel Holtmann
Hi Gustavo,
Quoted 44 lines
Remove unnecessary static on local variable hst. 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:@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 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 4029 2528 128 6685 1a1d drivers/bluetooth/btwilink.oafter:
text data bss dec hex filename
4007 2472 64 6543 198fdrivers/bluetooth/btwilink.o
Quoted 7 lines
Quoted 4 lines
Signed-off-by Gustavo A. R. Silva <[email protected]>---
drivers/bluetooth/btwilink.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)patch has been applied to bluetooth-next tree.
Great, thanks!
Signature · 1 line
Gustavo A. R. Silva