All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] ipmr: use goto to common label instead of opencoding
@ 2009-02-07  0:21 Ilpo Järvinen
  2009-02-07  0:21 ` [PATCH 2/4] ax25: more common return path joining Ilpo Järvinen
  2009-02-07  7:49 ` [PATCH 1/4] ipmr: use goto to common label instead of opencoding David Miller
  0 siblings, 2 replies; 9+ messages in thread
From: Ilpo Järvinen @ 2009-02-07  0:21 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Ilpo J�rvinen

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
---
 net/ipv4/ipmr.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 21a6dc7..13e9dd3 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -1243,8 +1243,7 @@ static void ipmr_queue_xmit(struct sk_buff *skb, struct mfc_cache *c, int vifi)
 		vif->dev->stats.tx_bytes += skb->len;
 		vif->dev->stats.tx_packets++;
 		ipmr_cache_report(net, skb, vifi, IGMPMSG_WHOLEPKT);
-		kfree_skb(skb);
-		return;
+		goto out_free;
 	}
 #endif
 
-- 
1.5.6.5


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

* [PATCH 2/4] ax25: more common return path joining
  2009-02-07  0:21 [PATCH 1/4] ipmr: use goto to common label instead of opencoding Ilpo Järvinen
@ 2009-02-07  0:21 ` Ilpo Järvinen
  2009-02-07  0:21   ` [PATCH 3/4] ipv6/ndisc: join error paths Ilpo Järvinen
  2009-02-07  0:28   ` [PATCH 2/4] ax25: more common return path joining Ralf Baechle
  2009-02-07  7:49 ` [PATCH 1/4] ipmr: use goto to common label instead of opencoding David Miller
  1 sibling, 2 replies; 9+ messages in thread
From: Ilpo Järvinen @ 2009-02-07  0:21 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Ilpo J�rvinen, Ralf Baechle

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Cc: Ralf Baechle <ralf@linux-mips.org>
---
 net/ax25/ax25_iface.c |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/net/ax25/ax25_iface.c b/net/ax25/ax25_iface.c
index 8443af5..71338f1 100644
--- a/net/ax25/ax25_iface.c
+++ b/net/ax25/ax25_iface.c
@@ -61,27 +61,24 @@ void ax25_protocol_release(unsigned int pid)
 
 	write_lock_bh(&protocol_list_lock);
 	protocol = protocol_list;
-	if (protocol == NULL) {
-		write_unlock_bh(&protocol_list_lock);
-		return;
-	}
+	if (protocol == NULL)
+		goto out;
 
 	if (protocol->pid == pid) {
 		protocol_list = protocol->next;
-		write_unlock_bh(&protocol_list_lock);
-		return;
+		goto out;
 	}
 
 	while (protocol != NULL && protocol->next != NULL) {
 		if (protocol->next->pid == pid) {
 			s = protocol->next;
 			protocol->next = protocol->next->next;
-			write_unlock_bh(&protocol_list_lock);
-			return;
+			goto out;
 		}
 
 		protocol = protocol->next;
 	}
+out:
 	write_unlock_bh(&protocol_list_lock);
 }
 
-- 
1.5.6.5


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

* [PATCH 3/4] ipv6/ndisc: join error paths
  2009-02-07  0:21 ` [PATCH 2/4] ax25: more common return path joining Ilpo Järvinen
@ 2009-02-07  0:21   ` Ilpo Järvinen
  2009-02-07  0:21     ` [PATCH 4/4] ipv6/addrconf: common code located Ilpo Järvinen
  2009-02-07  7:49     ` [PATCH 3/4] ipv6/ndisc: join error paths David Miller
  2009-02-07  0:28   ` [PATCH 2/4] ax25: more common return path joining Ralf Baechle
  1 sibling, 2 replies; 9+ messages in thread
From: Ilpo Järvinen @ 2009-02-07  0:21 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Ilpo J�rvinen

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
---
 net/ipv6/ndisc.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 3e29708..3cd83b8 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1538,13 +1538,10 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
 	if (rt->rt6i_flags & RTF_GATEWAY) {
 		ND_PRINTK2(KERN_WARNING
 			   "ICMPv6 Redirect: destination is not a neighbour.\n");
-		dst_release(dst);
-		return;
-	}
-	if (!xrlim_allow(dst, 1*HZ)) {
-		dst_release(dst);
-		return;
+		goto release;
 	}
+	if (!xrlim_allow(dst, 1*HZ))
+		goto release;
 
 	if (dev->addr_len) {
 		read_lock_bh(&neigh->lock);
@@ -1570,8 +1567,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
 		ND_PRINTK0(KERN_ERR
 			   "ICMPv6 Redirect: %s() failed to allocate an skb.\n",
 			   __func__);
-		dst_release(dst);
-		return;
+		goto release;
 	}
 
 	skb_reserve(buff, LL_RESERVED_SPACE(dev));
@@ -1631,6 +1627,10 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
 
 	if (likely(idev != NULL))
 		in6_dev_put(idev);
+	return;
+
+release:
+	dst_release(dst);
 }
 
 static void pndisc_redo(struct sk_buff *skb)
-- 
1.5.6.5


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

* [PATCH 4/4] ipv6/addrconf: common code located
  2009-02-07  0:21   ` [PATCH 3/4] ipv6/ndisc: join error paths Ilpo Järvinen
@ 2009-02-07  0:21     ` Ilpo Järvinen
  2009-02-07  7:49       ` David Miller
  2009-02-07  7:49     ` [PATCH 3/4] ipv6/ndisc: join error paths David Miller
  1 sibling, 1 reply; 9+ messages in thread
From: Ilpo Järvinen @ 2009-02-07  0:21 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Ilpo J�rvinen

$ codiff net/ipv6/addrconf.o net/ipv6/addrconf.o.new
net/ipv6/addrconf.c:
 addrconf_notify | -267
1 function changed, 267 bytes removed

net/ipv6/addrconf.c:
 add_addr |  +86
1 function changed, 86 bytes added

net/ipv6/addrconf.o.new:
2 functions changed, 86 bytes added, 267 bytes removed, diff: -181

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
---

If somebody has idea about better name for the function I'm open
to suggestions... I've some doubts that the name as is the best
possible :-).

 net/ipv6/addrconf.c |   45 ++++++++++++++++++---------------------------
 1 files changed, 18 insertions(+), 27 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index f9afb45..03e2a1a 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -2224,10 +2224,24 @@ int addrconf_del_ifaddr(struct net *net, void __user *arg)
 	return err;
 }
 
+static void add_addr(struct inet6_dev *idev, const struct in6_addr *addr,
+		     int plen, int scope)
+{
+	struct inet6_ifaddr *ifp;
+
+	ifp = ipv6_add_addr(idev, addr, plen, scope, IFA_F_PERMANENT);
+	if (!IS_ERR(ifp)) {
+		spin_lock_bh(&ifp->lock);
+		ifp->flags &= ~IFA_F_TENTATIVE;
+		spin_unlock_bh(&ifp->lock);
+		ipv6_ifa_notify(RTM_NEWADDR, ifp);
+		in6_ifa_put(ifp);
+	}
+}
+
 #if defined(CONFIG_IPV6_SIT) || defined(CONFIG_IPV6_SIT_MODULE)
 static void sit_add_v4_addrs(struct inet6_dev *idev)
 {
-	struct inet6_ifaddr * ifp;
 	struct in6_addr addr;
 	struct net_device *dev;
 	struct net *net = dev_net(idev->dev);
@@ -2246,14 +2260,7 @@ static void sit_add_v4_addrs(struct inet6_dev *idev)
 	}
 
 	if (addr.s6_addr32[3]) {
-		ifp = ipv6_add_addr(idev, &addr, 128, scope, IFA_F_PERMANENT);
-		if (!IS_ERR(ifp)) {
-			spin_lock_bh(&ifp->lock);
-			ifp->flags &= ~IFA_F_TENTATIVE;
-			spin_unlock_bh(&ifp->lock);
-			ipv6_ifa_notify(RTM_NEWADDR, ifp);
-			in6_ifa_put(ifp);
-		}
+		add_addr(idev, &addr, 128, scope);
 		return;
 	}
 
@@ -2281,15 +2288,7 @@ static void sit_add_v4_addrs(struct inet6_dev *idev)
 				else
 					plen = 96;
 
-				ifp = ipv6_add_addr(idev, &addr, plen, flag,
-						    IFA_F_PERMANENT);
-				if (!IS_ERR(ifp)) {
-					spin_lock_bh(&ifp->lock);
-					ifp->flags &= ~IFA_F_TENTATIVE;
-					spin_unlock_bh(&ifp->lock);
-					ipv6_ifa_notify(RTM_NEWADDR, ifp);
-					in6_ifa_put(ifp);
-				}
+				add_addr(idev, &addr, plen, flag);
 			}
 		}
 	}
@@ -2299,7 +2298,6 @@ static void sit_add_v4_addrs(struct inet6_dev *idev)
 static void init_loopback(struct net_device *dev)
 {
 	struct inet6_dev  *idev;
-	struct inet6_ifaddr * ifp;
 
 	/* ::1 */
 
@@ -2310,14 +2308,7 @@ static void init_loopback(struct net_device *dev)
 		return;
 	}
 
-	ifp = ipv6_add_addr(idev, &in6addr_loopback, 128, IFA_HOST, IFA_F_PERMANENT);
-	if (!IS_ERR(ifp)) {
-		spin_lock_bh(&ifp->lock);
-		ifp->flags &= ~IFA_F_TENTATIVE;
-		spin_unlock_bh(&ifp->lock);
-		ipv6_ifa_notify(RTM_NEWADDR, ifp);
-		in6_ifa_put(ifp);
-	}
+	add_addr(idev, &in6addr_loopback, 128, IFA_HOST);
 }
 
 static void addrconf_add_linklocal(struct inet6_dev *idev, struct in6_addr *addr)
-- 
1.5.6.5


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

* Re: [PATCH 2/4] ax25: more common return path joining
  2009-02-07  0:21 ` [PATCH 2/4] ax25: more common return path joining Ilpo Järvinen
  2009-02-07  0:21   ` [PATCH 3/4] ipv6/ndisc: join error paths Ilpo Järvinen
@ 2009-02-07  0:28   ` Ralf Baechle
  2009-02-07  7:49     ` David Miller
  1 sibling, 1 reply; 9+ messages in thread
From: Ralf Baechle @ 2009-02-07  0:28 UTC (permalink / raw)
  To: Ilpo Järvinen; +Cc: David Miller, netdev

On Sat, Feb 07, 2009 at 02:21:01AM +0200, Ilpo Järvinen wrote:

> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
> Cc: Ralf Baechle <ralf@linux-mips.org>

Looks good, thus

Acked-by: Ralf Baechle <ralf@linux-mips.org>

  Ralf

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

* Re: [PATCH 1/4] ipmr: use goto to common label instead of opencoding
  2009-02-07  0:21 [PATCH 1/4] ipmr: use goto to common label instead of opencoding Ilpo Järvinen
  2009-02-07  0:21 ` [PATCH 2/4] ax25: more common return path joining Ilpo Järvinen
@ 2009-02-07  7:49 ` David Miller
  1 sibling, 0 replies; 9+ messages in thread
From: David Miller @ 2009-02-07  7:49 UTC (permalink / raw)
  To: ilpo.jarvinen; +Cc: netdev

From: "Ilpo Järvinen" <ilpo.jarvinen@helsinki.fi>
Date: Sat,  7 Feb 2009 02:21:00 +0200

> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>

Applied.

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

* Re: [PATCH 2/4] ax25: more common return path joining
  2009-02-07  0:28   ` [PATCH 2/4] ax25: more common return path joining Ralf Baechle
@ 2009-02-07  7:49     ` David Miller
  0 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2009-02-07  7:49 UTC (permalink / raw)
  To: ralf; +Cc: ilpo.jarvinen, netdev

From: Ralf Baechle <ralf@linux-mips.org>
Date: Sat, 7 Feb 2009 00:28:33 +0000

> On Sat, Feb 07, 2009 at 02:21:01AM +0200, Ilpo Järvinen wrote:
> 
> > Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
> > Cc: Ralf Baechle <ralf@linux-mips.org>
> 
> Looks good, thus
> 
> Acked-by: Ralf Baechle <ralf@linux-mips.org>

Applied.

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

* Re: [PATCH 3/4] ipv6/ndisc: join error paths
  2009-02-07  0:21   ` [PATCH 3/4] ipv6/ndisc: join error paths Ilpo Järvinen
  2009-02-07  0:21     ` [PATCH 4/4] ipv6/addrconf: common code located Ilpo Järvinen
@ 2009-02-07  7:49     ` David Miller
  1 sibling, 0 replies; 9+ messages in thread
From: David Miller @ 2009-02-07  7:49 UTC (permalink / raw)
  To: ilpo.jarvinen; +Cc: netdev

From: "Ilpo Järvinen" <ilpo.jarvinen@helsinki.fi>
Date: Sat,  7 Feb 2009 02:21:02 +0200

> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>

Applied.

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

* Re: [PATCH 4/4] ipv6/addrconf: common code located
  2009-02-07  0:21     ` [PATCH 4/4] ipv6/addrconf: common code located Ilpo Järvinen
@ 2009-02-07  7:49       ` David Miller
  0 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2009-02-07  7:49 UTC (permalink / raw)
  To: ilpo.jarvinen; +Cc: netdev

From: "Ilpo Järvinen" <ilpo.jarvinen@helsinki.fi>
Date: Sat,  7 Feb 2009 02:21:03 +0200

> $ codiff net/ipv6/addrconf.o net/ipv6/addrconf.o.new
> net/ipv6/addrconf.c:
>  addrconf_notify | -267
> 1 function changed, 267 bytes removed
> 
> net/ipv6/addrconf.c:
>  add_addr |  +86
> 1 function changed, 86 bytes added
> 
> net/ipv6/addrconf.o.new:
> 2 functions changed, 86 bytes added, 267 bytes removed, diff: -181
> 
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>

Applied.

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

end of thread, other threads:[~2009-02-07  7:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-07  0:21 [PATCH 1/4] ipmr: use goto to common label instead of opencoding Ilpo Järvinen
2009-02-07  0:21 ` [PATCH 2/4] ax25: more common return path joining Ilpo Järvinen
2009-02-07  0:21   ` [PATCH 3/4] ipv6/ndisc: join error paths Ilpo Järvinen
2009-02-07  0:21     ` [PATCH 4/4] ipv6/addrconf: common code located Ilpo Järvinen
2009-02-07  7:49       ` David Miller
2009-02-07  7:49     ` [PATCH 3/4] ipv6/ndisc: join error paths David Miller
2009-02-07  0:28   ` [PATCH 2/4] ax25: more common return path joining Ralf Baechle
2009-02-07  7:49     ` David Miller
2009-02-07  7:49 ` [PATCH 1/4] ipmr: use goto to common label instead of opencoding David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.