linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/11] Drop unnecessary static
@ 2017-07-15 20:07 Julia Lawall
  2017-07-15 20:07 ` [PATCH 01/11] clk: mmp: " Julia Lawall
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Julia Lawall @ 2017-07-15 20:07 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-fbdev, Lars-Peter Clausen, keescook, linux-iio, linux-input,
	kernel-janitors, linux-kernel, linux-ide, linux-mtd,
	Peter Meerwald-Stadler, Hartmut Knaack, linux-omap, linux-clk

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(-)

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 01/11] clk: mmp: Drop unnecessary static
  2017-07-15 20:07 [PATCH 00/11] Drop unnecessary static Julia Lawall
@ 2017-07-15 20:07 ` Julia Lawall
  2017-07-18  1:31   ` Stephen Boyd
  2017-07-15 20:07 ` [PATCH 02/11] clk: moxart: " Julia Lawall
  2017-07-15 20:37 ` [PATCH 00/11] " Joe Perches
  2 siblings, 1 reply; 7+ messages in thread
From: Julia Lawall @ 2017-07-15 20:07 UTC (permalink / raw)
  To: Michael Turquette
  Cc: keescook, kernel-janitors, Stephen Boyd, linux-clk, linux-kernel

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>

---
These patches are all independent of each other.

 drivers/clk/mmp/clk.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -u -p a/drivers/clk/mmp/clk.c b/drivers/clk/mmp/clk.c
--- a/drivers/clk/mmp/clk.c
+++ b/drivers/clk/mmp/clk.c
@@ -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)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 02/11] clk: moxart: Drop unnecessary static
  2017-07-15 20:07 [PATCH 00/11] Drop unnecessary static Julia Lawall
  2017-07-15 20:07 ` [PATCH 01/11] clk: mmp: " Julia Lawall
@ 2017-07-15 20:07 ` Julia Lawall
  2017-07-18  1:31   ` Stephen Boyd
  2017-07-15 20:37 ` [PATCH 00/11] " Joe Perches
  2 siblings, 1 reply; 7+ messages in thread
From: Julia Lawall @ 2017-07-15 20:07 UTC (permalink / raw)
  To: Michael Turquette
  Cc: keescook, kernel-janitors, Stephen Boyd, linux-clk, linux-kernel

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>

---
These patches are all independent of each other.

 drivers/clk/clk-moxart.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff -u -p a/drivers/clk/clk-moxart.c b/drivers/clk/clk-moxart.c
--- a/drivers/clk/clk-moxart.c
+++ b/drivers/clk/clk-moxart.c
@@ -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,m
 
 static 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;

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 00/11] Drop unnecessary static
  2017-07-15 20:07 [PATCH 00/11] Drop unnecessary static Julia Lawall
  2017-07-15 20:07 ` [PATCH 01/11] clk: mmp: " Julia Lawall
  2017-07-15 20:07 ` [PATCH 02/11] clk: moxart: " Julia Lawall
@ 2017-07-15 20:37 ` Joe Perches
  2017-07-15 21:00   ` Julia Lawall
  2 siblings, 1 reply; 7+ messages in thread
From: Joe Perches @ 2017-07-15 20:37 UTC (permalink / raw)
  To: Julia Lawall, linux-arm-kernel
  Cc: keescook, kernel-janitors, linux-ide, linux-mtd, linux-kernel,
	linux-clk, linux-fbdev, linux-omap, Hartmut Knaack,
	Lars-Peter Clausen, Peter Meerwald-Stadler, linux-input,
	linux-iio

On Sat, 2017-07-15 at 22:07 +0200, Julia Lawall wrote:
> 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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 00/11] Drop unnecessary static
  2017-07-15 20:37 ` [PATCH 00/11] " Joe Perches
@ 2017-07-15 21:00   ` Julia Lawall
  0 siblings, 0 replies; 7+ messages in thread
From: Julia Lawall @ 2017-07-15 21:00 UTC (permalink / raw)
  To: Joe Perches
  Cc: Julia Lawall, linux-arm-kernel, keescook, kernel-janitors,
	linux-ide, linux-mtd, linux-kernel, linux-clk, linux-fbdev,
	linux-omap, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, linux-input, linux-iio



On Sat, 15 Jul 2017, Joe Perches wrote:

> On Sat, 2017-07-15 at 22:07 +0200, Julia Lawall wrote:
> > 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 02/11] clk: moxart: Drop unnecessary static
  2017-07-15 20:07 ` [PATCH 02/11] clk: moxart: " Julia Lawall
@ 2017-07-18  1:31   ` Stephen Boyd
  0 siblings, 0 replies; 7+ messages in thread
From: Stephen Boyd @ 2017-07-18  1:31 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Michael Turquette, keescook, kernel-janitors, linux-clk,
	linux-kernel

On 07/15, Julia Lawall 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>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> ---
> These patches are all independent of each other.

Already got this one a few days earlier.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 01/11] clk: mmp: Drop unnecessary static
  2017-07-15 20:07 ` [PATCH 01/11] clk: mmp: " Julia Lawall
@ 2017-07-18  1:31   ` Stephen Boyd
  0 siblings, 0 replies; 7+ messages in thread
From: Stephen Boyd @ 2017-07-18  1:31 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Michael Turquette, keescook, kernel-janitors, linux-clk,
	linux-kernel

On 07/15, Julia Lawall 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>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> ---

Applied to clk-next

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-07-18  1:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-15 20:07 [PATCH 00/11] Drop unnecessary static Julia Lawall
2017-07-15 20:07 ` [PATCH 01/11] clk: mmp: " Julia Lawall
2017-07-18  1:31   ` Stephen Boyd
2017-07-15 20:07 ` [PATCH 02/11] clk: moxart: " Julia Lawall
2017-07-18  1:31   ` Stephen Boyd
2017-07-15 20:37 ` [PATCH 00/11] " Joe Perches
2017-07-15 21:00   ` Julia Lawall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).