* [PATCH] soc: integrator: remove unnecessary static in integrator_soc_init()
@ 2017-07-19 22:39 Gustavo A. R. Silva
2017-08-02 11:58 ` Linus Walleij
0 siblings, 1 reply; 3+ messages in thread
From: Gustavo A. R. Silva @ 2017-07-19 22:39 UTC (permalink / raw)
To: Linus Walleij; +Cc: linux-kernel, 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;
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
drivers/soc/versatile/soc-integrator.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/soc/versatile/soc-integrator.c b/drivers/soc/versatile/soc-integrator.c
index a5d7d39..e45638a 100644
--- a/drivers/soc/versatile/soc-integrator.c
+++ b/drivers/soc/versatile/soc-integrator.c
@@ -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;
--
2.5.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] soc: integrator: remove unnecessary static in integrator_soc_init()
2017-07-19 22:39 [PATCH] soc: integrator: remove unnecessary static in integrator_soc_init() Gustavo A. R. Silva
@ 2017-08-02 11:58 ` Linus Walleij
2017-08-03 21:45 ` Gustavo A. R. Silva
0 siblings, 1 reply; 3+ messages in thread
From: Linus Walleij @ 2017-08-02 11:58 UTC (permalink / raw)
To: Gustavo A. R. Silva; +Cc: linux-kernel@vger.kernel.org
On Thu, Jul 20, 2017 at 12:39 AM, Gustavo A. R. Silva
<gustavo@embeddedor.com> wrote:
> 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;
>
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
You probably want to funnel this patch through the ARM SoC tree.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] soc: integrator: remove unnecessary static in integrator_soc_init()
2017-08-02 11:58 ` Linus Walleij
@ 2017-08-03 21:45 ` Gustavo A. R. Silva
0 siblings, 0 replies; 3+ messages in thread
From: Gustavo A. R. Silva @ 2017-08-03 21:45 UTC (permalink / raw)
To: Linus Walleij; +Cc: linux-kernel@vger.kernel.org
Hi Linus,
On 08/02/2017 06:58 AM, Linus Walleij wrote:
> On Thu, Jul 20, 2017 at 12:39 AM, Gustavo A. R. Silva
> <gustavo@embeddedor.com> wrote:
>
>> 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;
>>
>> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
>
> Acked-by: Linus Walleij <linus.walleij@linaro.org>
>
> 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
--
Gustavo A. R. Silva
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-08-03 21:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-19 22:39 [PATCH] soc: integrator: remove unnecessary static in integrator_soc_init() Gustavo A. R. Silva
2017-08-02 11:58 ` Linus Walleij
2017-08-03 21:45 ` Gustavo A. R. Silva
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox