mtd: physmap_of: Drop unnecessary static
authorJulia Lawall <julia.lawall@lip6.fr>
Sat, 15 Jul 2017 20:07:38 +0000 (22:07 +0200)
committerBoris Brezillon <boris.brezillon@free-electrons.com>
Tue, 15 Aug 2017 12:00:43 +0000 (14:00 +0200)
Drop static on a local variable, when the variable is initialized before
any possible use.  Thus, the static has no benefit.

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>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
drivers/mtd/maps/physmap_of_versatile.c

index 8c6ccded9be8020db4688bc0654c50aa2301e00f..03f2b6e7bc7e8d4332a5418dc52d6493f4baf2b5 100644 (file)
@@ -97,7 +97,7 @@ static const struct of_device_id ebi_match[] = {
 static int ap_flash_init(struct platform_device *pdev)
 {
        struct device_node *ebi;
-       static void __iomem *ebi_base;
+       void __iomem *ebi_base;
        u32 val;
        int ret;