Skip to contentSkip to conversation

soc: integrator: remove unnecessary static in integrator_soc_init()

PATCH In review Gustavo A. R. Silva 2 participants 3 messages Jul 19, 2017 – Aug 3, 2017 Arm integrator, versatile and realview support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 soc: integrator: remove unnecessary static in integrator_soc_init()

Remove unnecessary static on local variable syscon_regmap. Such variables are initialized before being used, on every execution path throughout the functions. So, the static has no benefit.

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;

---
 drivers/soc/versatile/soc-integrator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/versatile/soc-integrator.c +1 -1
index a5d7d39..e45638a 100644
@@ -102,7 +102,7 @@ static struct device_attribute integrator_build_attr =
 
 static int __init integrator_soc_init(void)
 {
-	static struct regmap *syscon_regmap;
+	struct regmap *syscon_regmap;
 	struct soc_device *soc_dev;
 	struct soc_device_attribute *soc_dev_attr;
 	struct device_node *np;
Signature · 1 line
2.5.0
Acked-by on v1 1/1
#1 lore raw
Quoted 25 lines · Gustavo A. R. Silva

Remove unnecessary static on local variable syscon_regmap. Such variables are initialized before being used, on every execution path throughout the functions. So, the static has no benefit.

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;
@@

Quoted 7 lines

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

You probably want to funnel this patch through the ARM SoC tree.

Yours,
Linus Walleij

#2 lore raw

Hi Linus,

Quoted 34 lines · Linus Walleij
Quoted 31 lines · Gustavo A. R. Silva

Remove unnecessary static on local variable syscon_regmap. Such variables are initialized before being used, on every execution path throughout the functions. So, the static has no benefit.

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;

Quoted 6 lines
Quoted 1 line

You probably want to funnel this patch through the ARM SoC tree.

I'll do that. I'll add your ACK and CC you.

Thanks

Signature · 1 line
Gustavo A. R. Silva