Drop unnecessary static
Subsystems (16)
cover Drop unnecessary static
These patches fix cases where there is a static on a local variable, but the variable is initialized before any possible use. Thus, the static has no benefit.
---
drivers/ata/sata_gemini.c | 2 +- drivers/clk/clk-moxart.c | 4 ++-- drivers/clk/mmp/clk.c | 2 +- drivers/iio/orientation/hid-sensor-rotation.c | 2 +- drivers/irqchip/irq-digicolor.c | 2 +- drivers/irqchip/irq-gic-realview.c | 2 +- drivers/irqchip/irq-mips-cpu.c | 2 +- drivers/mfd/max8925-i2c.c | 2 +- drivers/mfd/twl4030-irq.c | 2 +- drivers/mtd/maps/physmap_of_versatile.c | 2 +- drivers/video/fbdev/da8xx-fb.c | 2 +- 11 files changed, 12 insertions(+), 12 deletions(-)
PATCH 1/11 clk: mmp: Drop unnecessary static
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>
---
These patches are all independent of each other.
drivers/clk/mmp/clk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/mmp/clk.c +1 -1
@@ -9,7 +9,7 @@void mmp_clk_init (struct device_node *np,struct mmp_clk_unit *unit,int nr_clks) { -static struct clk **clk_table; +struct clk **clk_table; clk_table =kcalloc (nr_clks,sizeof (struct clk *),GFP_KERNEL );if (!clk_table)
Stephen Boyd
AppliedRe: [PATCH 01/11] clk: mmp: Drop unnecessary static
Quoted 29 lines · Julia Lawall
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>
Quoted 3 lines
Signed-off-by Julia Lawall <[email protected]>---
Applied to clk-next
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH 2/11 clk: moxart: Drop unnecessary static
In reply to Julia LawallDrop 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>
---
These patches are all independent of each other.
drivers/clk/clk-moxart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/clk-moxart.c +2 -2
@@ -18,7 +18,7 @@static void __init moxart_of_pll_clk_init (struct device_node *node) { -static void __iomem *base; +void __iomem *base;struct clk_hw *hw;struct clk *ref_clk;unsigned int mul;
@@ -57,7 +57,7 @@ CLK_OF_DECLARE(moxart_pll_clock, "moxa,mstatic void __init moxart_of_apb_clk_init (struct device_node *node) { -static void __iomem *base; +void __iomem *base;struct clk_hw *hw;struct clk *pll_clk;unsigned int div, val;
Re: [PATCH 02/11] clk: moxart: Drop unnecessary static
Quoted 29 lines · Julia Lawall
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>
Quoted 4 lines
Signed-off-by Julia Lawall <[email protected]>---
These patches are all independent of each other.
Already got this one a few days earlier.
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH 3/11 mtd: physmap_of: Drop unnecessary static
In reply to Julia LawallDrop 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>
---
These patches are all independent of each other.
drivers/mtd/maps/physmap_of_versatile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/maps/physmap_of_versatile.c +1 -1
@@ -97,7 +97,7 @@ static const struct of_device_id ebi_matstatic 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;
Re: [PATCH 03/11] mtd: physmap_of: Drop unnecessary static
Le Sat, 15 Jul 2017 22:07:38 +0200,
Julia Lawall <[email protected]> a écrit :
Quoted 29 lines
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>
Quoted 1 line
Signed-off-by Julia Lawall <[email protected]>
Quoted 12 lines
---
These patches are all independent of each other.drivers/mtd/maps/physmap_of_versatile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)diff -u -p
a/drivers/mtd/maps/physmap_of_versatile.cb/drivers/mtd/maps/physmap_of_versatile.c
drivers/mtd/maps/physmap_of_versatile.c static const struct of_device_id ebi_mat · line 103
Quoted 8 lines
drivers/mtd/maps/physmap_of_versatile.c +1
-1@@ -97,7 +97,7 @@ static const struct of_device_id ebi_matstatic 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;
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Boris Brezillon
AppliedRe: [PATCH 03/11] mtd: physmap_of: Drop unnecessary static
In reply to Julia LawallLe Sat, 15 Jul 2017 22:07:38 +0200,
Julia Lawall <[email protected]> a écrit :
Quoted 16 lines
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...+>
Quoted 13 lines
@@
identifier x;
expression e;
type T;
position p != bad.p;
@@
-static
T x@p;
... when != x
when strict
?x = e;
// </smpl>
Applied to l2-mtd/master.
Thanks,
Boris
Quoted 13 lines
Signed-off-by Julia Lawall <[email protected]>---
These patches are all independent of each other.drivers/mtd/maps/physmap_of_versatile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)diff -u -p
a/drivers/mtd/maps/physmap_of_versatile.cb/drivers/mtd/maps/physmap_of_versatile.c
drivers/mtd/maps/physmap_of_versatile.c static const struct of_device_id ebi_mat · line 103
Quoted 8 lines
drivers/mtd/maps/physmap_of_versatile.c +1
-1@@ -97,7 +97,7 @@ static const struct of_device_id ebi_matstatic 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;
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 4/11 fbdev: da8xx-fb: Drop unnecessary static
In reply to Julia LawallDrop 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>
---
These patches are all independent of each other.
drivers/video/fbdev/da8xx-fb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/da8xx-fb.c +1 -1
@@ -1341,7 +1341,7 @@ static int fb_probe(struct platform_devi { struct da8xx_lcdc_platform_data *fb_pdata dev_get_platdata(&device->dev); -static struct resource *lcdc_regs; +struct resource *lcdc_regs;struct lcd_ctrl_config *lcd_cfg;struct fb_videomode *lcdc_info;struct fb_info *da8xx_fb_info;
Re: [PATCH 04/11] fbdev: da8xx-fb: Drop unnecessary static
Quoted 29 lines · Julia Lawall
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>
Quoted 1 line
Signed-off-by Julia Lawall <[email protected]>
Patch queued for 4.14, thanks.
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
PATCH 5/11 irqchip/gic/realview: Drop unnecessary static
In reply to Julia LawallDrop 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>
---
These patches are all independent of each other.
drivers/irqchip/irq-gic-realview.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-gic-realview.c +1 -1
@@ -43,7 +43,7 @@ static const struct of_device_id syscon_static int __init realview_gic_of_init (struct device_node *node,struct device_node *parent) { -static struct regmap *map; +struct regmap *map;struct device_node *np;const struct of_device_id *gic_id;u32 pld1_ctrl;
tip-bot for Julia Lawall
merge bot[tip:irq/urgent] irqchip/gic/realview: Drop unnecessary static
irqchip/gic/realview: Drop unnecessary static
Commit-ID: 512f9e790897e84d5b802436768508ee4628fc16 Gitweb: http://git.kernel.org/tip/512f9e790897e84d5b802436768508ee4628fc16 Author: Julia Lawall <[email protected]> AuthorDate: Sat, 15 Jul 2017 22:07:40 +0200 Committer: Thomas Gleixner <[email protected]> CommitDate: Tue, 18 Jul 2017 21:59:22 +0200
irqchip/gic/realview: Drop unnecessary static
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>
--- drivers/irqchip/irq-gic-realview.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-gic-realview.c +1 -1
@@ -43,7 +43,7 @@ static const struct of_device_id syscon_pldset_of_match[] = {static int __init realview_gic_of_init (struct device_node *node,struct device_node *parent) { -static struct regmap *map; +struct regmap *map;struct device_node *np;const struct of_device_id *gic_id;u32 pld1_ctrl;
PATCH 6/11 irqchip: mips-cpu: Drop unnecessary static
In reply to Julia LawallDrop 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>
---
These patches are all independent of each other.
drivers/irqchip/irq-mips-cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-mips-cpu.c +1 -1
@@ -154,7 +154,7 @@ asmlinkage void __weak plat_irq_dispatchstatic int mips_cpu_intc_map (struct irq_domain *d,unsigned int irq,irq_hw_number_t hw) { -static struct irq_chip *chip; +struct irq_chip *chip;if (hw <2 && cpu_has_mipsmt) {/* Software interrupts are used for MT/CMT IPI */
Re: [PATCH 06/11] irqchip: mips-cpu: Drop unnecessary static
Quoted 5 lines · Julia Lawall
Drop static on a local variable, when the variable is initialized before any possible use. Thus, the static has no benefit.
I think this is in error like the other one. I believe that the irq_chip structure needs a persistent lifetime.
Quoted 39 lines
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 <[email protected]>---
These patches are all independent of each other.
drivers/irqchip/irq-mips-cpu.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)diff -u -p
a/drivers/irqchip/irq-mips-cpu.cb/drivers/irqchip/irq-mips-cpu.c
drivers/irqchip/irq-mips-cpu.c asmlinkage void __weak plat_irq_dispatch · line 160
Quoted 8 lines
drivers/irqchip/irq-mips-cpu.c +1
-1@@ -154,7 +154,7 @@ asmlinkage void __weak plat_irq_dispatchstatic int mips_cpu_intc_map (struct irq_domain *d,unsigned int irq,irq_hw_number_t hw) { -static struct irq_chip *chip; +struct irq_chip *chip;if (hw <2 && cpu_has_mipsmt) {/* Software interrupts are used for MT/CMT IPI */
--
Mark Rustad, [email protected]
Re: [PATCH 06/11] irqchip: mips-cpu: Drop unnecessary static
Quoted 7 lines · Mark D Rustad
Quoted 5 lines · Julia Lawall
Drop static on a local variable, when the variable is initialized before any possible use. Thus, the static has no benefit.
I think this is in error like the other one. I believe that the
irq_chipstructure needs a persistent lifetime.
I'm not following in this case. chip is a pointer to a structure, not a structure. Its address is not taken. irq_set_chip_and_handler that uses it below is a fnuction, so it just gets the value.
julia
Quoted 53 lines
Quoted 40 lines
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 <[email protected]>---
These patches are all independent of each other.
drivers/irqchip/irq-mips-cpu.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)diff -u -p
a/drivers/irqchip/irq-mips-cpu.cb/drivers/irqchip/irq-mips-cpu.cdrivers/irqchip/irq-mips-cpu.c asmlinkage void __weak plat_irq_dispatch · line 160
Quoted 8 lines
drivers/irqchip/irq-mips-cpu.c +1
-1@@ -154,7 +154,7 @@ asmlinkage void __weak plat_irq_dispatchstatic int mips_cpu_intc_map (struct irq_domain *d,unsigned int irq,irq_hw_number_t hw) { -static struct irq_chip *chip; +struct irq_chip *chip;if (hw <2 && cpu_has_mipsmt) {/* Software interrupts are used for MT/CMT IPI */ --
Mark Rustad, [email protected]
Re: [PATCH 06/11] irqchip: mips-cpu: Drop unnecessary static
Quoted 10 lines · Julia Lawall
Quoted 6 lines · Mark D Rustad
Quoted 5 lines · Julia Lawall
Drop static on a local variable, when the variable is initialized before any possible use. Thus, the static has no benefit.
Quoted 7 lines
Quoted 1 line
I think this is in error like the other one. I believe that the
irq_chipstructure needs a persistent lifetime.I'm not following in this case. chip is a pointer to a structure, not a structure. Its address is not taken.
irq_set_chip_and_handlerthat uses it below is a fnuction, so it just gets the value.julia
Sorry. My mistake. I didn't look quite hard enough at this one.
Quoted 45 lines
Quoted 45 lines
Quoted 45 lines
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 <[email protected]>---
These patches are all independent of each other.
drivers/irqchip/irq-mips-cpu.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)diff -u -p
a/drivers/irqchip/irq-mips-cpu.cb/drivers/irqchip/irq-mips-cpu.cdrivers/irqchip/irq-mips-cpu.c +1
-1@@ -154,7 +154,7 @@ asmlinkage void __weak plat_irq_dispatchstatic int mips_cpu_intc_map (struct irq_domain *d,unsigned int irq,irq_hw_number_t hw) { -static struct irq_chip *chip; +struct irq_chip *chip;
Quoted 6 lines
Quoted 6 lines
drivers/irqchip/irq-mips-cpu.c asmlinkage void __weak plat_irq_dispatch · line 160
Quoted 3 lines
drivers/irqchip/irq-mips-cpu.c +0
-0if (hw <2 && cpu_has_mipsmt) {/* Software interrupts are used for MT/CMT IPI */ --
Mark Rustad, [email protected]
--
Mark Rustad, [email protected]
tip-bot for Julia Lawall
merge bot[tip:irq/urgent] irqchip/mips-cpu: Drop unnecessary static
In reply to Julia Lawallirqchip/mips-cpu: Drop unnecessary static
Commit-ID: 82faeffa7e130e2ae43aa681a34c02d56dabd177 Gitweb: http://git.kernel.org/tip/82faeffa7e130e2ae43aa681a34c02d56dabd177 Author: Julia Lawall <[email protected]> AuthorDate: Sat, 15 Jul 2017 22:07:41 +0200 Committer: Thomas Gleixner <[email protected]> CommitDate: Tue, 18 Jul 2017 21:59:22 +0200
irqchip/mips-cpu: Drop unnecessary static
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>
--- drivers/irqchip/irq-mips-cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-mips-cpu.c +1 -1
@@ -154,7 +154,7 @@ asmlinkage void __weak plat_irq_dispatch(void)static int mips_cpu_intc_map (struct irq_domain *d,unsigned int irq,irq_hw_number_t hw) { -static struct irq_chip *chip; +struct irq_chip *chip;if (hw <2 && cpu_has_mipsmt) {/* Software interrupts are used for MT/CMT IPI */
PATCH 7/11 mfd: Drop unnecessary static
In reply to Julia LawallDrop 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>
---
These patches are all independent of each other.
drivers/mfd/twl4030-irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/twl4030-irq.c +1 -1
@@ -685,7 +685,7 @@ int twl4030_sih_setup(struct device *devint twl4030_init_irq (struct device *dev,int irq_num) { -static struct irq_chip twl4030_irq_chip; +struct irq_chip twl4030_irq_chip;int status, i;int irq_base, irq_end, nr_irqs;struct device_node *node = dev->of_node;
Re: [PATCH 07/11] mfd: Drop unnecessary static
Quoted 4 lines · Julia Lawall
Drop static on a local variable, when the variable is initialized before any possible use. Thus, the static has no benefit.
I think in this case the use relies on the structure continuing to exist, so a stack object is not an acceptable substitute. Just because it is initialized doesn't mean that it doesn't need a persistent lifetime.
Quoted 38 lines
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 <[email protected]>---
These patches are all independent of each other.
drivers/mfd/twl4030-irq.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)diff -u -p
a/drivers/mfd/twl4030-irq.cb/drivers/mfd/twl4030-irq.c
drivers/mfd/twl4030-irq.c int twl4030_sih_setup(struct device *dev · line 691
Quoted 8 lines
drivers/mfd/twl4030-irq.c +1
-1@@ -685,7 +685,7 @@ int twl4030_sih_setup(struct device *devint twl4030_init_irq (struct device *dev,int irq_num) { -static struct irq_chip twl4030_irq_chip; +struct irq_chip twl4030_irq_chip;int status, i;int irq_base, irq_end, nr_irqs;struct device_node *node = dev->of_node;
--
Mark Rustad, [email protected]
Re: [PATCH 07/11] mfd: Drop unnecessary static
Quoted 6 lines · Mark D Rustad
Quoted 4 lines · Julia Lawall
Drop static on a local variable, when the variable is initialized before any possible use. Thus, the static has no benefit.
I think in this case the use relies on the structure continuing to exist, so a stack object is not an acceptable substitute. Just because it is initialized doesn't mean that it doesn't need a persistent lifetime.
OK, I see. Thanks for the feedback. I'll extend the rule to ensure that the address of the variable is not taken. Ignore this patch in any case.
julia
Quoted 52 lines
Quoted 39 lines
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 <[email protected]>---
These patches are all independent of each other.
drivers/mfd/twl4030-irq.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)diff -u -p
a/drivers/mfd/twl4030-irq.cb/drivers/mfd/twl4030-irq.cdrivers/mfd/twl4030-irq.c int twl4030_sih_setup(struct device *dev · line 691
Quoted 8 lines
drivers/mfd/twl4030-irq.c +1
-1@@ -685,7 +685,7 @@ int twl4030_sih_setup(struct device *devint twl4030_init_irq (struct device *dev,int irq_num) { -static struct irq_chip twl4030_irq_chip; +struct irq_chip twl4030_irq_chip;int status, i;int irq_base, irq_end, nr_irqs;struct device_node *node = dev->of_node;--
Mark Rustad, [email protected]
Re: [PATCH 07/11] mfd: Drop unnecessary static
Hi!
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Drop static on a local variable, when the variable is initialized before any possible use. Thus, the static has no benefit.
Actually... it has possible other benefit -- saving stack space. I've used static for that purpose before. So ... careful with the automation.
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: [PATCH 07/11] mfd: Drop unnecessary static
Quoted 8 lines · Pavel Machek
Hi!
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Drop static on a local variable, when the variable is initialized before any possible use. Thus, the static has no benefit.
Actually... it has possible other benefit -- saving stack space. I've used static for that purpose before. So ... careful with the automation.
This means any functions like this must not be thread safe, though...
-Kees
Signature · 2 lines
Kees Cook Pixel Security
Re: [PATCH 07/11] mfd: Drop unnecessary static
In reply to Julia LawallQuoted 29 lines · Julia Lawall
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>
Quoted 7 lines
Signed-off-by Julia Lawall <[email protected]>---
These patches are all independent of each other.drivers/mfd/twl4030-irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Looks like I didn't reply to this patch.
Just to let you know, it has been applied.
Quoted 13 lines
diff -u -p
a/drivers/mfd/twl4030-irq.cb/drivers/mfd/twl4030-irq.cdrivers/mfd/twl4030-irq.c +1
-1@@ -685,7 +685,7 @@ int twl4030_sih_setup(struct device *devint twl4030_init_irq (struct device *dev,int irq_num) { -static struct irq_chip twl4030_irq_chip; +struct irq_chip twl4030_irq_chip;int status, i;int irq_base, irq_end, nr_irqs;struct device_node *node = dev->of_node;
Signature · 8 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog -- To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 8/11 ata: Drop unnecessary static
In reply to Julia LawallDrop 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>
---
These patches are all independent of each other.
drivers/ata/sata_gemini.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/sata_gemini.c +1 -1
@@ -305,7 +305,7 @@ static int gemini_sata_probe(struct platstruct device *dev = &pdev->dev;struct device_node *np = dev->of_node;struct sata_gemini *sg; -static struct regmap *map; +struct regmap *map;struct resource *res;enum gemini_muxmode muxmode;u32 gmode;
Re: [PATCH 08/11] ata: Drop unnecessary static
Quoted 29 lines · Julia Lawall
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>
Quoted 1 line
Signed-off-by Julia Lawall <[email protected]>
Yours,
Linus Walleij
Tejun Heo
AppliedRe: [PATCH 08/11] ata: Drop unnecessary static
In reply to Julia LawallQuoted 29 lines · Julia Lawall
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>
Quoted 1 line
Signed-off-by Julia Lawall <[email protected]>
Applied to libata/for-4.14.
Thanks.
Signature · 1 line
tejun
PATCH 9/11 iio: orientation: hid-sensor-rotation: Drop unnecessary static
In reply to Julia LawallDrop 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>
---
These patches are all independent of each other.
drivers/iio/orientation/hid-sensor-rotation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/orientation/hid-sensor-rotation.c +1 -1
@@ -238,7 +238,7 @@ static int dev_rot_parse_report(struct pstatic int hid_dev_rot_probe (struct platform_device *pdev) {int ret; -static char *name; +char *name;struct iio_dev *indio_dev;struct dev_rot_state *rot_state;struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
Re: [PATCH 09/11] iio: orientation: hid-sensor-rotation: Drop unnecessary static
Quoted 29 lines · On Sat, 15 Jul 2017 22:07:44 +0200 Julia Lawall <[email protected]> wrote:
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>
Quoted 1 line
Signed-off-by Julia Lawall <[email protected]>
Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it.
Thanks,
Jonathan
Quoted 20 lines
---
These patches are all independent of each other.drivers/iio/orientation/hid-sensor-rotation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)diff -u -p
a/drivers/iio/orientation/hid-sensor-rotation.cb/drivers/iio/orientation/hid-sensor-rotation.cdrivers/iio/orientation/hid-sensor-rotation.c +1
-1@@ -238,7 +238,7 @@ static int dev_rot_parse_report(struct pstatic int hid_dev_rot_probe (struct platform_device *pdev) {int ret; -static char *name; +char *name;struct iio_dev *indio_dev;struct dev_rot_state *rot_state;struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
PATCH 10/11 irqchip: digicolor: Drop unnecessary static
In reply to Julia LawallDrop 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>
---
These patches are all independent of each other.
drivers/irqchip/irq-digicolor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-digicolor.c +1 -1
@@ -71,7 +71,7 @@ static void __init digicolor_set_gc(voidstatic int __init digicolor_of_init (struct device_node *node,struct device_node *parent) { -static void __iomem *reg_base; +void __iomem *reg_base;unsigned int clr =IRQ_NOREQUEST |IRQ_NOPROBE |IRQ_NOAUTOEN ;struct regmap *ucregs;int ret;
Re: [PATCH 10/11] irqchip: digicolor: Drop unnecessary static
Hi Julia,
Quoted 29 lines · Julia Lawall
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>
Quoted 1 line
Signed-off-by Julia Lawall <[email protected]>
Thanks,
baruch
Quoted 19 lines
---
These patches are all independent of each other.drivers/irqchip/irq-digicolor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)diff -u -p
a/drivers/irqchip/irq-digicolor.cb/drivers/irqchip/irq-digicolor.cdrivers/irqchip/irq-digicolor.c +1
-1@@ -71,7 +71,7 @@ static void __init digicolor_set_gc(voidstatic int __init digicolor_of_init (struct device_node *node,struct device_node *parent) { -static void __iomem *reg_base; +void __iomem *reg_base;unsigned int clr =IRQ_NOREQUEST |IRQ_NOPROBE |IRQ_NOAUTOEN ;struct regmap *ucregs;int ret;
Signature · 2 lines
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{ - [email protected] - tel: +972.52.368.4656, http://www.tkos.co.il -tip-bot for Julia Lawall
merge bot[tip:irq/urgent] irqchip/digicolor: Drop unnecessary static
In reply to Julia Lawallirqchip/digicolor: Drop unnecessary static
Commit-ID: acc80c39929b9f2ff8b45fcfe103385a3e45c1a7 Gitweb: http://git.kernel.org/tip/acc80c39929b9f2ff8b45fcfe103385a3e45c1a7 Author: Julia Lawall <[email protected]> AuthorDate: Sat, 15 Jul 2017 22:07:45 +0200 Committer: Thomas Gleixner <[email protected]> CommitDate: Tue, 18 Jul 2017 21:59:23 +0200
irqchip/digicolor: Drop unnecessary static
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>
--- drivers/irqchip/irq-digicolor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-digicolor.c +1 -1
@@ -71,7 +71,7 @@ static void __init digicolor_set_gc(void __iomem *reg_base, unsigned irq_base,static int __init digicolor_of_init (struct device_node *node,struct device_node *parent) { -static void __iomem *reg_base; +void __iomem *reg_base;unsigned int clr =IRQ_NOREQUEST |IRQ_NOPROBE |IRQ_NOAUTOEN ;struct regmap *ucregs;int ret;
PATCH 11/11 mfd: max8925-i2c: Drop unnecessary static
In reply to Julia LawallDrop 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>
---
These patches are all independent of each other.
drivers/mfd/max8925-i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/max8925-i2c.c +1 -1
@@ -151,7 +151,7 @@ static int max8925_probe(struct i2c_clie const struct i2c_device_id *id) {struct max8925_platform_data *pdata =dev_get_platdata (&client->dev); -static struct max8925_chip *chip; +struct max8925_chip *chip;struct device_node *node = client->dev.of_node;if (node && !pdata) {
Lee Jones
AppliedRe: [PATCH 11/11] mfd: max8925-i2c: Drop unnecessary static
Quoted 29 lines · Julia Lawall
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>
Quoted 7 lines
Signed-off-by Julia Lawall <[email protected]>---
These patches are all independent of each other.drivers/mfd/max8925-i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Applied, thanks.
Quoted 13 lines
diff -u -p
a/drivers/mfd/max8925-i2c.cb/drivers/mfd/max8925-i2c.cdrivers/mfd/max8925-i2c.c +1
-1@@ -151,7 +151,7 @@ static int max8925_probe(struct i2c_clie const struct i2c_device_id *id) {struct max8925_platform_data *pdata =dev_get_platdata (&client->dev); -static struct max8925_chip *chip; +struct max8925_chip *chip;struct device_node *node = client->dev.of_node;if (node && !pdata) {
Signature · 8 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog -- To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 3 lines · Julia Lawall
These patches fix cases where there is a static on a local variable, but the variable is initialized before any possible use. Thus, the static has no benefit.
Nice one.
Quoted 6 lines · Joe Perches
Quoted 3 lines · Julia Lawall
These patches fix cases where there is a static on a local variable, but the variable is initialized before any possible use. Thus, the static has no benefit.
Nice one.
Thanks. It was suggested by Kees Cook a while ago. There seem to be many opportunities.
julia