2010-01-16 15:57:46

by Julia Lawall

[permalink] [raw]
Subject: [PATCH 2/9] drivers/misc: Eliminate useless code

From: Julia Lawall <[email protected]>

The variable priv is initialized twice to the same (side effect-free)
expression. Drop one initialization.

A simplified version of the semantic match that finds this problem is:
(http://coccinelle.lip6.fr/)

// <smpl>
@forall@
idexpression *x;
identifier f!=ERR_PTR;
@@

x = f(...)
... when != x
(
x = f(...,<+...x...+>,...)
|
* x = f(...)
)
// </smpl>

Signed-off-by: Julia Lawall <[email protected]>

---
drivers/misc/iwmc3200top/main.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/misc/iwmc3200top/main.c b/drivers/misc/iwmc3200top/main.c
index dd0a391..3b7292a 100644
--- a/drivers/misc/iwmc3200top/main.c
+++ b/drivers/misc/iwmc3200top/main.c
@@ -597,10 +597,8 @@ static void iwmct_remove(struct sdio_func *func)
struct iwmct_work_struct *read_req;
struct iwmct_priv *priv = sdio_get_drvdata(func);

- priv = sdio_get_drvdata(func);
-
LOG_INFO(priv, INIT, "enter\n");

sdio_claim_host(func);


2010-01-23 19:43:36

by Tomas Winkler

[permalink] [raw]
Subject: Re: [PATCH 2/9] drivers/misc: Eliminate useless code

On Sat, Jan 16, 2010 at 5:57 PM, Julia Lawall <[email protected]> wrote:
> From: Julia Lawall <[email protected]>
>
> The variable priv is initialized twice to the same (side effect-free)
> expression.  Drop one initialization.
>
> A simplified version of the semantic match that finds this problem is:
> (http://coccinelle.lip6.fr/)
>
> // <smpl>
> @forall@
> idexpression *x;
> identifier f!=ERR_PTR;
> @@
>
> x = f(...)
> ... when != x
> (
> x = f(...,<+...x...+>,...)
> |
> * x = f(...)
> )
> // </smpl>
>
> Signed-off-by: Julia Lawall <[email protected]>
Acked-by Tomas.Winker <[email protected]>


I appreciate if you CC me next time.

Thanks
Tomas