netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/9] drop unneeded goto
@ 2015-05-28 21:02 Julia Lawall
  2015-05-28 21:02 ` [PATCH 2/9] ipv6: " Julia Lawall
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Julia Lawall @ 2015-05-28 21:02 UTC (permalink / raw)
  To: devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b
  Cc: kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	HPDD-discuss-hn68Rpc1hR1g9hUCZPvPmw,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-media-u79uwXL29TY76Z2rM5mHXA,
	linux-nfs-u79uwXL29TY76Z2rM5mHXA,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA

These patches drop gotos that jump to a label that is at the next
instruction, in the case that the label is not used elsewhere in the
function.  The complete semantic patch that performs this transformation is
as follows:

// <smpl>
@r@
position p;
identifier l;
@@

if (...) goto l@p;
l:

@script:ocaml s@
p << r.p;
nm;
@@

nm := (List.hd p).current_element

@ok exists@
identifier s.nm,l;
position p != r.p;
@@

nm(...) {
<+... goto l@p; ...+>
}

@depends on !ok@
identifier s.nm;
position r.p;
identifier l;
@@

nm(...) {
<...
- if(...) goto l@p; l:
...>
}
// </smpl>

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 2/9] ipv6: drop unneeded goto
  2015-05-28 21:02 [PATCH 0/9] drop unneeded goto Julia Lawall
@ 2015-05-28 21:02 ` Julia Lawall
  2015-05-31  6:49   ` David Miller
  2015-05-28 21:02 ` [PATCH 5/9] wl1251: " Julia Lawall
  2015-05-28 21:02 ` [PATCH 6/9] ssb: " Julia Lawall
  2 siblings, 1 reply; 6+ messages in thread
From: Julia Lawall @ 2015-05-28 21:02 UTC (permalink / raw)
  To: David S. Miller
  Cc: kernel-janitors, Alexey Kuznetsov, James Morris,
	Hideaki YOSHIFUJI, Patrick McHardy, netdev, linux-kernel

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

Delete jump to a label on the next line, when that label is not
used elsewhere.

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

// <smpl>
@r@
identifier l;
@@

-if (...) goto l;
-l:
// </smpl>

Also remove the unnecessary ret variable.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 net/ipv6/raw.c |    8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 484a5c1..ca4700c 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -1327,13 +1327,7 @@ static struct inet_protosw rawv6_protosw = {
 
 int __init rawv6_init(void)
 {
-	int ret;
-
-	ret = inet6_register_protosw(&rawv6_protosw);
-	if (ret)
-		goto out;
-out:
-	return ret;
+	return inet6_register_protosw(&rawv6_protosw);
 }
 
 void rawv6_exit(void)

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

* [PATCH 5/9] wl1251: drop unneeded goto
  2015-05-28 21:02 [PATCH 0/9] drop unneeded goto Julia Lawall
  2015-05-28 21:02 ` [PATCH 2/9] ipv6: " Julia Lawall
@ 2015-05-28 21:02 ` Julia Lawall
  2015-06-08  8:39   ` [5/9] " Kalle Valo
  2015-05-28 21:02 ` [PATCH 6/9] ssb: " Julia Lawall
  2 siblings, 1 reply; 6+ messages in thread
From: Julia Lawall @ 2015-05-28 21:02 UTC (permalink / raw)
  To: Kalle Valo; +Cc: kernel-janitors, linux-wireless, netdev, linux-kernel

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

Delete jump to a label on the next line, when that label is not
used elsewhere.

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

// <smpl>
@r@
identifier l;
@@

-if (...) goto l;
-l:
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/net/wireless/ti/wl1251/acx.c |    3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/wireless/ti/wl1251/acx.c b/drivers/net/wireless/ti/wl1251/acx.c
index 5695628..d6fbdda 100644
--- a/drivers/net/wireless/ti/wl1251/acx.c
+++ b/drivers/net/wireless/ti/wl1251/acx.c
@@ -53,10 +53,7 @@ int wl1251_acx_station_id(struct wl1251 *wl)
 		mac->mac[i] = wl->mac_addr[ETH_ALEN - 1 - i];
 
 	ret = wl1251_cmd_configure(wl, DOT11_STATION_ID, mac, sizeof(*mac));
-	if (ret < 0)
-		goto out;
 
-out:
 	kfree(mac);
 	return ret;
 }

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

* [PATCH 6/9] ssb: drop unneeded goto
  2015-05-28 21:02 [PATCH 0/9] drop unneeded goto Julia Lawall
  2015-05-28 21:02 ` [PATCH 2/9] ipv6: " Julia Lawall
  2015-05-28 21:02 ` [PATCH 5/9] wl1251: " Julia Lawall
@ 2015-05-28 21:02 ` Julia Lawall
  2 siblings, 0 replies; 6+ messages in thread
From: Julia Lawall @ 2015-05-28 21:02 UTC (permalink / raw)
  To: Michael Buesch; +Cc: kernel-janitors, netdev, linux-kernel

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

Delete jump to a label on the next line, when that label is not
used elsewhere.

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

// <smpl>
@r@
identifier l;
@@

-if (...) goto l;
-l:
// </smpl>

Also drop the unneeded err variable.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/ssb/pci.c |    8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/ssb/pci.c b/drivers/ssb/pci.c
index 0f28c08..d6ca4d3 100644
--- a/drivers/ssb/pci.c
+++ b/drivers/ssb/pci.c
@@ -1173,17 +1173,11 @@ void ssb_pci_exit(struct ssb_bus *bus)
 int ssb_pci_init(struct ssb_bus *bus)
 {
 	struct pci_dev *pdev;
-	int err;
 
 	if (bus->bustype != SSB_BUSTYPE_PCI)
 		return 0;
 
 	pdev = bus->host_pci;
 	mutex_init(&bus->sprom_mutex);
-	err = device_create_file(&pdev->dev, &dev_attr_ssb_sprom);
-	if (err)
-		goto out;
-
-out:
-	return err;
+	return device_create_file(&pdev->dev, &dev_attr_ssb_sprom);
 }

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

* Re: [PATCH 2/9] ipv6: drop unneeded goto
  2015-05-28 21:02 ` [PATCH 2/9] ipv6: " Julia Lawall
@ 2015-05-31  6:49   ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2015-05-31  6:49 UTC (permalink / raw)
  To: Julia.Lawall
  Cc: kernel-janitors, kuznet, jmorris, yoshfuji, kaber, netdev, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>
Date: Thu, 28 May 2015 23:02:17 +0200

> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Delete jump to a label on the next line, when that label is not
> used elsewhere.
> 
> A simplified version of the semantic patch that makes this change is as
> follows: (http://coccinelle.lip6.fr/)
 ...
> Also remove the unnecessary ret variable.
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Applied, thanks Julia.

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

* Re: [5/9] wl1251: drop unneeded goto
  2015-05-28 21:02 ` [PATCH 5/9] wl1251: " Julia Lawall
@ 2015-06-08  8:39   ` Kalle Valo
  0 siblings, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2015-06-08  8:39 UTC (permalink / raw)
  To: Julia Lawall; +Cc: kernel-janitors, linux-wireless, netdev, linux-kernel


> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Delete jump to a label on the next line, when that label is not
> used elsewhere.
> 
> A simplified version of the semantic patch that makes this change is as
> follows: (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @r@
> identifier l;
> @@
> 
> -if (...) goto l;
> -l:
> // </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Thanks, applied to wireless-drivers-next.git.

Kalle Valo

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

end of thread, other threads:[~2015-06-08  8:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-28 21:02 [PATCH 0/9] drop unneeded goto Julia Lawall
2015-05-28 21:02 ` [PATCH 2/9] ipv6: " Julia Lawall
2015-05-31  6:49   ` David Miller
2015-05-28 21:02 ` [PATCH 5/9] wl1251: " Julia Lawall
2015-06-08  8:39   ` [5/9] " Kalle Valo
2015-05-28 21:02 ` [PATCH 6/9] ssb: " 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).