public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 4/4] staging: tidspbridge: delete useless variable
  2014-01-13 16:17 ` [PATCH 4/4] staging: tidspbridge: " Julia Lawall
@ 2014-01-13 15:48   ` Dan Carpenter
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2014-01-13 15:48 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Omar Ramirez Luna, devel, Greg Kroah-Hartman, kernel-janitors,
	linux-kernel

On Mon, Jan 13, 2014 at 05:17:27PM +0100, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> The variable status is initialized to either 0 or an error code.  Return
> status to propagate the error value.
> 

Could you update the subject to say that the patch was a bugfix.

regards,
dan carpenter


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

* [PATCH 0/4] delete useless variable
@ 2014-01-13 16:17 Julia Lawall
  2014-01-13 16:17 ` [PATCH 1/4] ksz884x: " Julia Lawall
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Julia Lawall @ 2014-01-13 16:17 UTC (permalink / raw)
  To: brcm80211-dev-list
  Cc: kernel-janitors, linux-wireless, netdev, linux-kernel,
	linux-fbdev, devel

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>


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

* [PATCH 1/4] ksz884x: delete useless variable
  2014-01-13 16:17 [PATCH 0/4] delete useless variable Julia Lawall
@ 2014-01-13 16:17 ` Julia Lawall
  2014-01-15 21:43   ` David Miller
  2014-01-13 16:17 ` [PATCH 2/4] i810: " Julia Lawall
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Julia Lawall @ 2014-01-13 16:17 UTC (permalink / raw)
  To: netdev; +Cc: kernel-janitors, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Delete a variable that is at most only assigned to a constant, but never
used otherwise.  In this code, it is the variable result that is used for
the return code, not rc.

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 <Julia.Lawall@lip6.fr>

---
 drivers/net/ethernet/micrel/ksz884x.c |    3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/ethernet/micrel/ksz884x.c b/drivers/net/ethernet/micrel/ksz884x.c
index 8e9dad7..ce84dc2 100644
--- a/drivers/net/ethernet/micrel/ksz884x.c
+++ b/drivers/net/ethernet/micrel/ksz884x.c
@@ -5853,15 +5853,12 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 	struct dev_info *hw_priv = priv->adapter;
 	struct ksz_hw *hw = &hw_priv->hw;
 	struct ksz_port *port = &priv->port;
-	int rc;
 	int result = 0;
 	struct mii_ioctl_data *data = if_mii(ifr);
 
 	if (down_interruptible(&priv->proc_sem))
 		return -ERESTARTSYS;
 
-	/* assume success */
-	rc = 0;
 	switch (cmd) {
 	/* Get address of MII PHY in use. */
 	case SIOCGMIIPHY:


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

* [PATCH 2/4] i810: delete useless variable
  2014-01-13 16:17 [PATCH 0/4] delete useless variable Julia Lawall
  2014-01-13 16:17 ` [PATCH 1/4] ksz884x: " Julia Lawall
@ 2014-01-13 16:17 ` Julia Lawall
  2014-01-14  8:06   ` Tomi Valkeinen
  2014-01-13 16:17 ` [PATCH 3/4] brcmsmac: " Julia Lawall
  2014-01-13 16:17 ` [PATCH 4/4] staging: tidspbridge: " Julia Lawall
  3 siblings, 1 reply; 8+ messages in thread
From: Julia Lawall @ 2014-01-13 16:17 UTC (permalink / raw)
  To: Antonino Daplas
  Cc: kernel-janitors, Jean-Christophe Plagniol-Villard, Tomi Valkeinen,
	linux-fbdev, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

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 <Julia.Lawall@lip6.fr>

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


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

* [PATCH 3/4] brcmsmac: delete useless variable
  2014-01-13 16:17 [PATCH 0/4] delete useless variable Julia Lawall
  2014-01-13 16:17 ` [PATCH 1/4] ksz884x: " Julia Lawall
  2014-01-13 16:17 ` [PATCH 2/4] i810: " Julia Lawall
@ 2014-01-13 16:17 ` Julia Lawall
  2014-01-13 16:17 ` [PATCH 4/4] staging: tidspbridge: " Julia Lawall
  3 siblings, 0 replies; 8+ messages in thread
From: Julia Lawall @ 2014-01-13 16:17 UTC (permalink / raw)
  To: Brett Rudley
  Cc: kernel-janitors, Arend van Spriel, Franky (Zhenhui) Lin,
	Hante Meuleman, John W. Linville, linux-wireless,
	brcm80211-dev-list, netdev, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

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 <Julia.Lawall@lip6.fr>

---
I don't know whether the comment before the removed assignment should also
be adjusted.

 drivers/net/wireless/brcm80211/brcmsmac/main.c |    2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c
index 8138f1c..9417cb5 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
@@ -7108,7 +7108,6 @@ prep_mac80211_status(struct brcms_c_info *wlc, struct d11rxhdr *rxh,
 		     struct sk_buff *p,
 		     struct ieee80211_rx_status *rx_status)
 {
-	int preamble;
 	int channel;
 	u32 rspec;
 	unsigned char *plcp;
@@ -7191,7 +7190,6 @@ prep_mac80211_status(struct brcms_c_info *wlc, struct d11rxhdr *rxh,
 			rx_status->rate_idx -= BRCMS_LEGACY_5G_RATE_OFFSET;
 
 		/* Determine short preamble and rate_idx */
-		preamble = 0;
 		if (is_cck_rate(rspec)) {
 			if (rxh->PhyRxStatus_0 & PRXS0_SHORTH)
 				rx_status->flag |= RX_FLAG_SHORTPRE;


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

* [PATCH 4/4] staging: tidspbridge: delete useless variable
  2014-01-13 16:17 [PATCH 0/4] delete useless variable Julia Lawall
                   ` (2 preceding siblings ...)
  2014-01-13 16:17 ` [PATCH 3/4] brcmsmac: " Julia Lawall
@ 2014-01-13 16:17 ` Julia Lawall
  2014-01-13 15:48   ` Dan Carpenter
  3 siblings, 1 reply; 8+ messages in thread
From: Julia Lawall @ 2014-01-13 16:17 UTC (permalink / raw)
  To: Omar Ramirez Luna
  Cc: kernel-janitors, Greg Kroah-Hartman, devel, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

The variable status is initialized to either 0 or an error code.  Return
status to propagate the error value.

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 <Julia.Lawall@lip6.fr>

---
Most remove functions only return 0, as this one did before the change.  So
perhaps the correct solution is to remove the status variable?

 drivers/staging/tidspbridge/rmgr/drv_interface.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/tidspbridge/rmgr/drv_interface.c b/drivers/staging/tidspbridge/rmgr/drv_interface.c
index cafca46..74d31da 100644
--- a/drivers/staging/tidspbridge/rmgr/drv_interface.c
+++ b/drivers/staging/tidspbridge/rmgr/drv_interface.c
@@ -589,7 +589,7 @@ func_cont:
 		class_destroy(bridge_class);
 
 	}
-	return 0;
+	return status;
 }
 
 #ifdef CONFIG_PM


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

* Re: [PATCH 2/4] i810: delete useless variable
  2014-01-13 16:17 ` [PATCH 2/4] i810: " Julia Lawall
@ 2014-01-14  8:06   ` Tomi Valkeinen
  0 siblings, 0 replies; 8+ messages in thread
From: Tomi Valkeinen @ 2014-01-14  8:06 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Antonino Daplas, kernel-janitors,
	Jean-Christophe Plagniol-Villard, linux-fbdev, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1218 bytes --]

On 2014-01-13 18:17, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> 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 <Julia.Lawall@lip6.fr>
> 
> ---
>  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



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]

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

* Re: [PATCH 1/4] ksz884x: delete useless variable
  2014-01-13 16:17 ` [PATCH 1/4] ksz884x: " Julia Lawall
@ 2014-01-15 21:43   ` David Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2014-01-15 21:43 UTC (permalink / raw)
  To: Julia.Lawall; +Cc: netdev, kernel-janitors, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>
Date: Mon, 13 Jan 2014 17:17:24 +0100

> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Delete a variable that is at most only assigned to a constant, but never
> used otherwise.  In this code, it is the variable result that is used for
> the return code, not rc.
> 
> A simplified version of the semantic patch that fixes this problem is as
> follows: (http://coccinelle.lip6.fr/)
 ...
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Applied, thank you.

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

end of thread, other threads:[~2014-01-15 21:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-13 16:17 [PATCH 0/4] delete useless variable Julia Lawall
2014-01-13 16:17 ` [PATCH 1/4] ksz884x: " Julia Lawall
2014-01-15 21:43   ` David Miller
2014-01-13 16:17 ` [PATCH 2/4] i810: " Julia Lawall
2014-01-14  8:06   ` Tomi Valkeinen
2014-01-13 16:17 ` [PATCH 3/4] brcmsmac: " Julia Lawall
2014-01-13 16:17 ` [PATCH 4/4] staging: tidspbridge: " Julia Lawall
2014-01-13 15:48   ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox