# \[PATCH 0/4\] delete useless variable

- Subsystems: FRAMEBUFFER LAYER, NETWORKING DRIVERS, NETWORKING DRIVERS (WIRELESS), STAGING SUBSYSTEM, THE REST
- Maintainers: Helge Deller, Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Johannes Berg, Greg Kroah-Hartman, Linus Torvalds
- Series: 4 patches touching 4 files, +2/-9
- List: linux-fbdev
- 3 messages, 2 authors
- Page: https://ratatoskr.run/linux-fbdev/2014/01/4180198/t

## \[PATCH 0/4\] delete useless variable

- From: Julia Lawall \<hidden\>
- Date: 2014-01-13 15:22:08 
- Message: https://ratatoskr.run/linux-fbdev/2014/01/4180198.md

```text
These patches delete declarations and initializations of variables that are
only assigned to constants but never used otherwise.

The complete semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r exists@
type T;
identifier i,i2;
position p;
@@

T i@p;
... 
i = i2

@@
type r.T;
identifier r.i;
constant c;
position p != r.p;
@@

-T i@p;
<... when != i
-i = c;
...>
// </smpl>

```

## \[PATCH 2/4\] i810: delete useless variable

- From: Julia Lawall \<hidden\>
- Date: 2014-01-13 15:21:49 
- Message: https://ratatoskr.run/linux-fbdev/2014/01/4180196.md

```text
From: Julia Lawall <redacted>

Delete a variable that is at most only assigned to a constant, but never
used otherwise.

A simplified version of the semantic patch that fixes this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
type T;
identifier i;
constant c;
@@

-T i;
<... when != i
-i = c;
...>
// </smpl>

Signed-off-by: Julia Lawall <redacted>

---
 drivers/video/i810/i810_main.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/video/i810/i810_main.c b/drivers/video/i810/i810_main.c
index 038192a..bb674e4 100644
--- a/drivers/video/i810/i810_main.c
+++ b/drivers/video/i810/i810_main.c
@@ -2011,9 +2011,7 @@ static int i810fb_init_pci(struct pci_dev *dev,
 	struct fb_info    *info;
 	struct i810fb_par *par = NULL;
 	struct fb_videomode mode;
-	int i, err = -1, vfreq, hfreq, pixclock;
-
-	i = 0;
+	int err = -1, vfreq, hfreq, pixclock;
 
 	info = framebuffer_alloc(sizeof(struct i810fb_par), &dev->dev);
 	if (!info)

```

## Re: \[PATCH 2/4\] i810: delete useless variable

- From: Tomi Valkeinen \<hidden\>
- Date: 2014-01-14 08:06:30 
- Message: https://ratatoskr.run/linux-fbdev/2014/01/4181120.md

```text
On 2014-01-13 18:17, Julia Lawall wrote:
> From: Julia Lawall <redacted>
> 
> Delete a variable that is at most only assigned to a constant, but never
> used otherwise.
> 
> A simplified version of the semantic patch that fixes this problem is as
> follows: (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @@
> type T;
> identifier i;
> constant c;
> @@
> 
> -T i;
> <... when != i
> -i = c;
> ...>
> // </smpl>
> 
> Signed-off-by: Julia Lawall <redacted>
> 
> ---
>  drivers/video/i810/i810_main.c |    4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/video/i810/i810_main.c b/drivers/video/i810/i810_main.c
> index 038192a..bb674e4 100644
> --- a/drivers/video/i810/i810_main.c
> +++ b/drivers/video/i810/i810_main.c
> @@ -2011,9 +2011,7 @@ static int i810fb_init_pci(struct pci_dev *dev,
>  	struct fb_info    *info;
>  	struct i810fb_par *par = NULL;
>  	struct fb_videomode mode;
> -	int i, err = -1, vfreq, hfreq, pixclock;
> -
> -	i = 0;
> +	int err = -1, vfreq, hfreq, pixclock;
>  
>  	info = framebuffer_alloc(sizeof(struct i810fb_par), &dev->dev);
>  	if (!info)
> 

Thanks, queued for 3.14.

 Tomi


```
