Skip to content

Commit 96e4f52

Browse files
JuliaLawallbroonie
authored andcommitted
regulator: palmas: Drop unnecessary static
Drop static on a local variable, when the variable is initialized before any use, on every possible execution path through the function. The semantic patch that fixes this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @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; // </smpl> There is no reduction in code size in this case, but the change does reduce the size of the bss segment, containing uninitialized static data. before: text data bss dec hex filename 12882 3480 8 16370 3ff2 drivers/regulator/palmas-regulator.o after: text data bss dec hex filename 12882 3480 0 16362 3fea drivers/regulator/palmas-regulator.o Signed-off-by: Julia Lawall <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent 2ea659a commit 96e4f52

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/regulator/palmas-regulator.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1491,7 +1491,7 @@ static int palmas_dt_to_pdata(struct device *dev,
14911491
}
14921492

14931493
for (idx = 0; idx < ddata->max_reg; idx++) {
1494-
static struct of_regulator_match *match;
1494+
struct of_regulator_match *match;
14951495
struct palmas_reg_init *rinit;
14961496
struct device_node *np;
14971497

0 commit comments

Comments
 (0)