All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/4] ipv6: coding style improvements
@ 2014-09-02 19:16 Ian Morris
  2014-09-02 19:16 ` [PATCH net-next 1/4] ipv6: coding style - no assignment in if statements Ian Morris
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Ian Morris @ 2014-09-02 19:16 UTC (permalink / raw)
  To: netdev; +Cc: Ian Morris

This sequences of patches makes adjustments to the ipv6 code to try to better
follow the kernel coding style guidelines. No changes to the resultant object
code is detected by objdiff.

Ian Morris (4):
  ipv6: coding style - no assignment in if statements
  ipv6: coding style - min to min_t conversion
  ipv6: coding style - convert printk
  ipv6: coding style - cleanse bracing

 net/ipv6/addrconf.c       |   30 ++++++++++++++++------------
 net/ipv6/addrconf_core.c  |    3 +--
 net/ipv6/ah6.c            |    7 ++++---
 net/ipv6/datagram.c       |    3 ++-
 net/ipv6/esp6.c           |    3 ++-
 net/ipv6/exthdrs_core.c   |    6 +++---
 net/ipv6/icmp.c           |    3 ++-
 net/ipv6/ip6_fib.c        |    4 ++--
 net/ipv6/ip6_flowlabel.c  |    9 ++++++---
 net/ipv6/ip6_gre.c        |    4 ++--
 net/ipv6/ip6_input.c      |   16 +++++++--------
 net/ipv6/ip6_output.c     |   32 ++++++++++++++++--------------
 net/ipv6/ip6_tunnel.c     |   22 ++++++++++-----------
 net/ipv6/ip6_vti.c        |    4 ++--
 net/ipv6/ip6mr.c          |   13 ++++++------
 net/ipv6/ipv6_sockglue.c  |    7 ++++---
 net/ipv6/mcast.c          |   48 ++++++++++++++++++++++++++-------------------
 net/ipv6/ndisc.c          |   25 ++++++++++-------------
 net/ipv6/ping.c           |    8 ++++----
 net/ipv6/raw.c            |    3 ++-
 net/ipv6/reassembly.c     |    3 ++-
 net/ipv6/route.c          |   25 +++++++++++------------
 net/ipv6/sit.c            |    7 ++++---
 net/ipv6/tcp_ipv6.c       |   10 ++++++----
 net/ipv6/udp.c            |   26 ++++++++++++------------
 net/ipv6/xfrm6_output.c   |    4 ++--
 net/ipv6/xfrm6_protocol.c |   25 ++++++++++++++---------
 net/ipv6/xfrm6_tunnel.c   |    3 ++-
 28 files changed, 191 insertions(+), 162 deletions(-)

-- 
1.7.9.5

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

* [PATCH net-next 1/4] ipv6: coding style - no assignment in if statements
  2014-09-02 19:16 [PATCH net-next 0/4] ipv6: coding style improvements Ian Morris
@ 2014-09-02 19:16 ` Ian Morris
  2014-09-03  1:44   ` YOSHIFUJI Hideaki
  2014-09-02 19:16 ` [PATCH net-next 2/4] ipv6: coding style - min to min_t conversion Ian Morris
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: Ian Morris @ 2014-09-02 19:16 UTC (permalink / raw)
  To: netdev; +Cc: Ian Morris

This patch makes no changes to the logic of the ipv6 stack however
it addresses some coding style issues by removing assignments made
in if statements.

No change in the object output is detected by the objdiff script.

Signed-off-by: Ian Morris <ipm@chirality.org.uk>
---
 net/ipv6/addrconf.c       |   12 ++++++++----
 net/ipv6/ah6.c            |    7 ++++---
 net/ipv6/datagram.c       |    3 ++-
 net/ipv6/esp6.c           |    3 ++-
 net/ipv6/icmp.c           |    3 ++-
 net/ipv6/ip6_flowlabel.c  |    6 +++++-
 net/ipv6/ip6_input.c      |    3 ++-
 net/ipv6/ip6_output.c     |   17 ++++++++++-------
 net/ipv6/ip6_tunnel.c     |   16 ++++++++--------
 net/ipv6/ip6_vti.c        |    4 ++--
 net/ipv6/ndisc.c          |    7 ++++---
 net/ipv6/raw.c            |    3 ++-
 net/ipv6/reassembly.c     |    3 ++-
 net/ipv6/sit.c            |    7 ++++---
 net/ipv6/udp.c            |    6 ++++--
 net/ipv6/xfrm6_protocol.c |   25 ++++++++++++++++---------
 16 files changed, 77 insertions(+), 48 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 267ce3c..509c53e 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -2524,7 +2524,8 @@ static int inet6_addr_del(struct net *net, int ifindex, u32 ifa_flags,
 	if (!dev)
 		return -ENODEV;
 
-	if ((idev = __in6_dev_get(dev)) == NULL)
+	idev = __in6_dev_get(dev);
+	if (idev == NULL)
 		return -ENXIO;
 
 	read_lock_bh(&idev->lock);
@@ -2671,7 +2672,8 @@ static void init_loopback(struct net_device *dev)
 
 	ASSERT_RTNL();
 
-	if ((idev = ipv6_find_idev(dev)) == NULL) {
+	idev = ipv6_find_idev(dev);
+	if (idev == NULL) {
 		pr_debug("%s: add_dev failed\n", __func__);
 		return;
 	}
@@ -2794,7 +2796,8 @@ static void addrconf_sit_config(struct net_device *dev)
 	 * our v4 addrs in the tunnel
 	 */
 
-	if ((idev = ipv6_find_idev(dev)) == NULL) {
+	idev = ipv6_find_idev(dev);
+	if (idev == NULL) {
 		pr_debug("%s: add_dev failed\n", __func__);
 		return;
 	}
@@ -2818,7 +2821,8 @@ static void addrconf_gre_config(struct net_device *dev)
 
 	ASSERT_RTNL();
 
-	if ((idev = ipv6_find_idev(dev)) == NULL) {
+	idev = ipv6_find_idev(dev);
+	if (idev == NULL) {
 		pr_debug("%s: add_dev failed\n", __func__);
 		return;
 	}
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c
index fcffd4e..dc33a77 100644
--- a/net/ipv6/ah6.c
+++ b/net/ipv6/ah6.c
@@ -354,7 +354,8 @@ static int ah6_output(struct xfrm_state *x, struct sk_buff *skb)
 	ahp = x->data;
 	ahash = ahp->ahash;
 
-	if ((err = skb_cow_data(skb, 0, &trailer)) < 0)
+	err = skb_cow_data(skb, 0, &trailer);
+	if (err < 0)
 		goto out;
 	nfrags = err;
 
@@ -560,8 +561,8 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb)
 	if (!pskb_may_pull(skb, ah_hlen))
 		goto out;
 
-
-	if ((err = skb_cow_data(skb, 0, &trailer)) < 0)
+	err = skb_cow_data(skb, 0, &trailer);
+	if (err < 0)
 		goto out;
 	nfrags = err;
 
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index 1844e87..69f3153 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -418,7 +418,8 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len, int *addr_len)
 	/* Reset and regenerate socket error */
 	spin_lock_bh(&sk->sk_error_queue.lock);
 	sk->sk_err = 0;
-	if ((skb2 = skb_peek(&sk->sk_error_queue)) != NULL) {
+	skb2 = skb_peek(&sk->sk_error_queue);
+	if (skb2 != NULL) {
 		sk->sk_err = SKB_EXT_ERR(skb2)->ee.ee_errno;
 		spin_unlock_bh(&sk->sk_error_queue.lock);
 		sk->sk_error_report(sk);
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
index 83fc3a3..3cee92d 100644
--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.c
@@ -345,7 +345,8 @@ static int esp6_input(struct xfrm_state *x, struct sk_buff *skb)
 		goto out;
 	}
 
-	if ((nfrags = skb_cow_data(skb, 0, &trailer)) < 0) {
+	nfrags = skb_cow_data(skb, 0, &trailer);
+	if (nfrags < 0) {
 		ret = -EINVAL;
 		goto out;
 	}
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index 394bb82..5c79dbb 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -239,7 +239,8 @@ int icmpv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6,
 	struct icmp6hdr *icmp6h;
 	int err = 0;
 
-	if ((skb = skb_peek(&sk->sk_write_queue)) == NULL)
+	skb = skb_peek(&sk->sk_write_queue);
+	if (skb == NULL)
 		goto out;
 
 	icmp6h = icmp6_hdr(skb);
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
index 3dd7d4e..36da541 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -654,7 +654,11 @@ release:
 			goto done;
 
 		err = -ENOMEM;
-		if (sfl1 == NULL || (err = mem_check(sk)) != 0)
+		if (sfl1 == NULL)
+			goto done;
+
+		err = mem_check(sk);
+		if (err != 0)
 			goto done;
 
 		fl1 = fl_intern(net, fl, freq.flr_label);
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
index a3084ab..aacdcb4 100644
--- a/net/ipv6/ip6_input.c
+++ b/net/ipv6/ip6_input.c
@@ -220,7 +220,8 @@ resubmit:
 	nexthdr = skb_network_header(skb)[nhoff];
 
 	raw = raw6_local_deliver(skb, nexthdr);
-	if ((ipprot = rcu_dereference(inet6_protos[nexthdr])) != NULL) {
+	ipprot = rcu_dereference(inet6_protos[nexthdr]);
+	if (ipprot != NULL) {
 		int ret;
 
 		if (ipprot->flags & INET6_PROTO_FINAL) {
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index b7a3e7b..86fc687 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -754,9 +754,8 @@ slow_path:
 		/*
 		 *	Allocate buffer.
 		 */
-
-		if ((frag = alloc_skb(len + hlen + sizeof(struct frag_hdr) +
-				      hroom + troom, GFP_ATOMIC)) == NULL) {
+		frag = alloc_skb(len + hlen + sizeof(struct frag_hdr) + hroom + troom, GFP_ATOMIC);
+		if (frag == NULL) {
 			NETDEBUG(KERN_INFO "IPv6: frag: no memory for new fragment!\n");
 			IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)),
 				      IPSTATS_MIB_FRAGFAILS);
@@ -904,7 +903,8 @@ static int ip6_dst_lookup_tail(struct sock *sk,
 	if (*dst == NULL)
 		*dst = ip6_route_output(net, sk, fl6);
 
-	if ((err = (*dst)->error))
+	err = (*dst)->error;
+	if (err)
 		goto out_err_release;
 
 	if (ipv6_addr_any(&fl6->saddr)) {
@@ -952,7 +952,8 @@ static int ip6_dst_lookup_tail(struct sock *sk,
 			memcpy(&fl_gw6, fl6, sizeof(struct flowi6));
 			memset(&fl_gw6.daddr, 0, sizeof(struct in6_addr));
 			*dst = ip6_route_output(net, sk, &fl_gw6);
-			if ((err = (*dst)->error))
+			err = (*dst)->error;
+			if (err)
 				goto out_err_release;
 		}
 	}
@@ -1060,7 +1061,8 @@ static inline int ip6_ufo_append_data(struct sock *sk,
 	 * device, so create one single skb packet containing complete
 	 * udp datagram
 	 */
-	if ((skb = skb_peek_tail(&sk->sk_write_queue)) == NULL) {
+	skb = skb_peek_tail(&sk->sk_write_queue);
+	if (skb == NULL) {
 		skb = sock_alloc_send_skb(sk,
 			hh_len + fragheaderlen + transhdrlen + 20,
 			(flags & MSG_DONTWAIT), &err);
@@ -1540,7 +1542,8 @@ int ip6_push_pending_frames(struct sock *sk)
 	unsigned char proto = fl6->flowi6_proto;
 	int err = 0;
 
-	if ((skb = __skb_dequeue(&sk->sk_write_queue)) == NULL)
+	skb = __skb_dequeue(&sk->sk_write_queue);
+	if (skb == NULL)
 		goto out;
 	tail_skb = &(skb_shinfo(skb)->frag_list);
 
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index e01bd03..b38cc18 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -482,8 +482,8 @@ ip6_tnl_err(struct sk_buff *skb, __u8 ipproto, struct inet6_skb_parm *opt,
 	   processing of the error. */
 
 	rcu_read_lock();
-	if ((t = ip6_tnl_lookup(dev_net(skb->dev), &ipv6h->daddr,
-					&ipv6h->saddr)) == NULL)
+	t = ip6_tnl_lookup(dev_net(skb->dev), &ipv6h->daddr, &ipv6h->saddr);
+	if (t == NULL)
 		goto out;
 
 	if (t->parms.proto != ipproto && t->parms.proto != 0)
@@ -530,7 +530,8 @@ ip6_tnl_err(struct sk_buff *skb, __u8 ipproto, struct inet6_skb_parm *opt,
 			mtu = IPV6_MIN_MTU;
 		t->dev->mtu = mtu;
 
-		if ((len = sizeof(*ipv6h) + ntohs(ipv6h->payload_len)) > mtu) {
+		len = sizeof(*ipv6h) + ntohs(ipv6h->payload_len);
+		if (len > mtu) {
 			rel_type = ICMPV6_PKT_TOOBIG;
 			rel_code = 0;
 			rel_info = mtu;
@@ -790,9 +791,8 @@ static int ip6_tnl_rcv(struct sk_buff *skb, __u16 protocol,
 	int err;
 
 	rcu_read_lock();
-
-	if ((t = ip6_tnl_lookup(dev_net(skb->dev), &ipv6h->saddr,
-					&ipv6h->daddr)) != NULL) {
+	t = ip6_tnl_lookup(dev_net(skb->dev), &ipv6h->saddr, &ipv6h->daddr);
+	if (t != NULL) {
 		struct pcpu_sw_netstats *tstats;
 
 		if (t->parms.proto != ipproto && t->parms.proto != 0) {
@@ -1016,8 +1016,8 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
 	if (skb_headroom(skb) < max_headroom || skb_shared(skb) ||
 	    (skb_cloned(skb) && !skb_clone_writable(skb, 0))) {
 		struct sk_buff *new_skb;
-
-		if (!(new_skb = skb_realloc_headroom(skb, max_headroom)))
+		new_skb = skb_realloc_headroom(skb, max_headroom);
+		if (!new_skb)
 			goto tx_err_dst_release;
 
 		if (skb->sk)
diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c
index 7f52fd9..77a194f 100644
--- a/net/ipv6/ip6_vti.c
+++ b/net/ipv6/ip6_vti.c
@@ -287,8 +287,8 @@ static int vti6_rcv(struct sk_buff *skb)
 	const struct ipv6hdr *ipv6h = ipv6_hdr(skb);
 
 	rcu_read_lock();
-	if ((t = vti6_tnl_lookup(dev_net(skb->dev), &ipv6h->saddr,
-				 &ipv6h->daddr)) != NULL) {
+	t = vti6_tnl_lookup(dev_net(skb->dev), &ipv6h->saddr, &ipv6h->daddr);
+	if (t != NULL) {
 		if (t->parms.proto != IPPROTO_IPV6 && t->parms.proto != 0) {
 			rcu_read_unlock();
 			goto discard;
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 4cb45c1..d0232b2 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -162,7 +162,8 @@ static void ndisc_fill_addr_option(struct sk_buff *skb, int type, void *data)
 	memcpy(opt+2, data, data_len);
 	data_len += 2;
 	opt += data_len;
-	if ((space -= data_len) > 0)
+	space -= data_len;
+	if (space > 0)
 		memset(opt, 0, space);
 }
 
@@ -656,8 +657,8 @@ static void ndisc_solicit(struct neighbour *neigh, struct sk_buff *skb)
 
 	if (skb && ipv6_chk_addr(dev_net(dev), &ipv6_hdr(skb)->saddr, dev, 1))
 		saddr = &ipv6_hdr(skb)->saddr;
-
-	if ((probes -= NEIGH_VAR(neigh->parms, UCAST_PROBES)) < 0) {
+	probes -= NEIGH_VAR(neigh->parms, UCAST_PROBES);
+	if (probes < 0) {
 		if (!(neigh->nud_state & NUD_VALID)) {
 			ND_PRINTK(1, dbg,
 				  "%s: trying to ucast probe in NUD_INVALID: %pI6\n",
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 896af88..af3661c 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -548,7 +548,8 @@ static int rawv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6,
 	if (!rp->checksum)
 		goto send;
 
-	if ((skb = skb_peek(&sk->sk_write_queue)) == NULL)
+	skb = skb_peek(&sk->sk_write_queue);
+	if (skb == NULL)
 		goto out;
 
 	offset = rp->offset;
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index 1a157ca..9bd8a04 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -429,7 +429,8 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff *prev,
 		struct sk_buff *clone;
 		int i, plen = 0;
 
-		if ((clone = alloc_skb(0, GFP_ATOMIC)) == NULL)
+		clone = alloc_skb(0, GFP_ATOMIC);
+		if (clone == NULL)
 			goto out_oom;
 		clone->next = head->next;
 		head->next = clone;
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 86e3fa8..e2b199f 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -1229,7 +1229,8 @@ ipip6_tunnel_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 			if (copy_from_user(&p, ifr->ifr_ifru.ifru_data, sizeof(p)))
 				goto done;
 			err = -ENOENT;
-			if ((t = ipip6_tunnel_locate(net, &p, 0)) == NULL)
+			t = ipip6_tunnel_locate(net, &p, 0);
+			if (t == NULL)
 				goto done;
 			err = -EPERM;
 			if (t == netdev_priv(sitn->fb_tunnel_dev))
@@ -1748,8 +1749,8 @@ static int __net_init sit_init_net(struct net *net)
 		goto err_dev_free;
 
 	ipip6_tunnel_clone_6rd(sitn->fb_tunnel_dev, sitn);
-
-	if ((err = register_netdev(sitn->fb_tunnel_dev)))
+	err = register_netdev(sitn->fb_tunnel_dev);
+	if (err)
 		goto err_reg_dev;
 
 	t = netdev_priv(sitn->fb_tunnel_dev);
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 12fcce8f..e06d460 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -357,7 +357,8 @@ static struct sock *__udp6_lib_lookup_skb(struct sk_buff *skb,
 	struct sock *sk;
 	const struct ipv6hdr *iph = ipv6_hdr(skb);
 
-	if (unlikely(sk = skb_steal_sock(skb)))
+	sk = skb_steal_sock(skb);
+	if (unlikely(sk))
 		return sk;
 	return __udp6_lib_lookup(dev_net(skb_dst(skb)->dev), &iph->saddr, sport,
 				 &iph->daddr, dport, inet6_iif(skb),
@@ -1021,7 +1022,8 @@ static int udp_v6_push_pending_frames(struct sock *sk)
 	fl6 = &inet->cork.fl.u.ip6;
 
 	/* Grab the skbuff where UDP header space exists. */
-	if ((skb = skb_peek(&sk->sk_write_queue)) == NULL)
+	skb = skb_peek(&sk->sk_write_queue);
+	if (skb == NULL)
 		goto out;
 
 	/*
diff --git a/net/ipv6/xfrm6_protocol.c b/net/ipv6/xfrm6_protocol.c
index 54d13f8..f200927 100644
--- a/net/ipv6/xfrm6_protocol.c
+++ b/net/ipv6/xfrm6_protocol.c
@@ -55,9 +55,11 @@ int xfrm6_rcv_cb(struct sk_buff *skb, u8 protocol, int err)
 	if (!head)
 		return 0;
 
-	for_each_protocol_rcu(*proto_handlers(protocol), handler)
-		if ((ret = handler->cb_handler(skb, err)) <= 0)
+	for_each_protocol_rcu(*proto_handlers(protocol), handler) {
+		ret = handler->cb_handler(skb, err);
+		if (ret <= 0)
 			return ret;
+		}
 
 	return 0;
 }
@@ -70,9 +72,11 @@ static int xfrm6_esp_rcv(struct sk_buff *skb)
 
 	XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6 = NULL;
 
-	for_each_protocol_rcu(esp6_handlers, handler)
-		if ((ret = handler->handler(skb)) != -EINVAL)
+	for_each_protocol_rcu(esp6_handlers, handler) {
+		ret = handler->handler(skb);
+		if (ret != -EINVAL)
 			return ret;
+		}
 
 	icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_PORT_UNREACH, 0);
 
@@ -97,9 +101,11 @@ static int xfrm6_ah_rcv(struct sk_buff *skb)
 
 	XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6 = NULL;
 
-	for_each_protocol_rcu(ah6_handlers, handler)
-		if ((ret = handler->handler(skb)) != -EINVAL)
+	for_each_protocol_rcu(ah6_handlers, handler) {
+		ret = handler->handler(skb);
+		if (ret != -EINVAL)
 			return ret;
+		}
 
 	icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_PORT_UNREACH, 0);
 
@@ -124,10 +130,11 @@ static int xfrm6_ipcomp_rcv(struct sk_buff *skb)
 
 	XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6 = NULL;
 
-	for_each_protocol_rcu(ipcomp6_handlers, handler)
-		if ((ret = handler->handler(skb)) != -EINVAL)
+	for_each_protocol_rcu(ipcomp6_handlers, handler) {
+		ret = handler->handler(skb);
+		if (ret != -EINVAL)
 			return ret;
-
+		}
 	icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_PORT_UNREACH, 0);
 
 	kfree_skb(skb);
-- 
1.7.9.5

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

* [PATCH net-next 2/4] ipv6: coding style - min to min_t conversion
  2014-09-02 19:16 [PATCH net-next 0/4] ipv6: coding style improvements Ian Morris
  2014-09-02 19:16 ` [PATCH net-next 1/4] ipv6: coding style - no assignment in if statements Ian Morris
@ 2014-09-02 19:16 ` Ian Morris
  2014-09-03  1:29   ` YOSHIFUJI Hideaki
  2014-09-02 19:16 ` [PATCH net-next 3/4] ipv6: coding style - convert printk Ian Morris
  2014-09-02 19:16 ` [PATCH net-next 4/4] ipv6: coding style - cleanse bracing Ian Morris
  3 siblings, 1 reply; 10+ messages in thread
From: Ian Morris @ 2014-09-02 19:16 UTC (permalink / raw)
  To: netdev; +Cc: Ian Morris

This patch changes a min to min_t as per checkpatch recomendation.

No change in the object output is detected by the objdiff script.

Signed-off-by: Ian Morris <ipm@chirality.org.uk>
---
 net/ipv6/addrconf.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 509c53e..23d8493 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -2320,8 +2320,11 @@ ok:
 			else
 				stored_lft = 0;
 			if (!update_lft && !create && stored_lft) {
-				const u32 minimum_lft = min(
-					stored_lft, (u32)MIN_VALID_LIFETIME);
+				const u32 minimum_lft = min_t(
+							  u32,
+							  stored_lft,
+							  MIN_VALID_LIFETIME);
+
 				valid_lft = max(valid_lft, minimum_lft);
 
 				/* RFC4862 Section 5.5.3e:
-- 
1.7.9.5

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

* [PATCH net-next 3/4] ipv6: coding style - convert printk
  2014-09-02 19:16 [PATCH net-next 0/4] ipv6: coding style improvements Ian Morris
  2014-09-02 19:16 ` [PATCH net-next 1/4] ipv6: coding style - no assignment in if statements Ian Morris
  2014-09-02 19:16 ` [PATCH net-next 2/4] ipv6: coding style - min to min_t conversion Ian Morris
@ 2014-09-02 19:16 ` Ian Morris
  2014-09-03  1:44   ` YOSHIFUJI Hideaki
  2014-09-02 19:16 ` [PATCH net-next 4/4] ipv6: coding style - cleanse bracing Ian Morris
  3 siblings, 1 reply; 10+ messages in thread
From: Ian Morris @ 2014-09-02 19:16 UTC (permalink / raw)
  To: netdev; +Cc: Ian Morris

No change in the object output is detected by the objdiff script.

Signed-off-by: Ian Morris <ipm@chirality.org.uk>
---
 net/ipv6/exthdrs_core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv6/exthdrs_core.c b/net/ipv6/exthdrs_core.c
index 8af3eb5..2f2945d 100644
--- a/net/ipv6/exthdrs_core.c
+++ b/net/ipv6/exthdrs_core.c
@@ -198,7 +198,7 @@ int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
 
 		ip6 = skb_header_pointer(skb, *offset, sizeof(_ip6), &_ip6);
 		if (!ip6 || (ip6->version != 6)) {
-			printk(KERN_ERR "IPv6 header not found\n");
+			pr_err("IPv6 header not found\n");
 			return -EBADMSG;
 		}
 		start = *offset + sizeof(struct ipv6hdr);
-- 
1.7.9.5

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

* [PATCH net-next 4/4] ipv6: coding style - cleanse bracing
  2014-09-02 19:16 [PATCH net-next 0/4] ipv6: coding style improvements Ian Morris
                   ` (2 preceding siblings ...)
  2014-09-02 19:16 ` [PATCH net-next 3/4] ipv6: coding style - convert printk Ian Morris
@ 2014-09-02 19:16 ` Ian Morris
  2014-09-03  1:31   ` YOSHIFUJI Hideaki/吉藤英明
  3 siblings, 1 reply; 10+ messages in thread
From: Ian Morris @ 2014-09-02 19:16 UTC (permalink / raw)
  To: netdev; +Cc: Ian Morris

Tidy up braces in a few places (mainly if statements):
* remove unnecessary braces
* add braces for single line statements where part of an "else" where the other branch has braces

No change in the object output is detected by the objdiff script.

Signed-off-by: Ian Morris <ipm@chirality.org.uk>
---
 net/ipv6/addrconf.c      |   11 +++++------
 net/ipv6/addrconf_core.c |    3 +--
 net/ipv6/exthdrs_core.c  |    4 ++--
 net/ipv6/ip6_fib.c       |    4 ++--
 net/ipv6/ip6_flowlabel.c |    3 +--
 net/ipv6/ip6_gre.c       |    4 ++--
 net/ipv6/ip6_input.c     |   13 +++++--------
 net/ipv6/ip6_output.c    |   15 +++++++--------
 net/ipv6/ip6_tunnel.c    |    6 +++---
 net/ipv6/ip6mr.c         |   13 +++++++------
 net/ipv6/ipv6_sockglue.c |    7 ++++---
 net/ipv6/mcast.c         |   48 +++++++++++++++++++++++++++-------------------
 net/ipv6/ndisc.c         |   18 ++++++-----------
 net/ipv6/ping.c          |    8 ++++----
 net/ipv6/route.c         |   25 +++++++++++-------------
 net/ipv6/tcp_ipv6.c      |   10 ++++++----
 net/ipv6/udp.c           |   20 +++++++++----------
 net/ipv6/xfrm6_output.c  |    4 ++--
 net/ipv6/xfrm6_tunnel.c  |    3 ++-
 19 files changed, 108 insertions(+), 111 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 23d8493..f31a204 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -895,9 +895,9 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr,
 out2:
 	rcu_read_unlock_bh();
 
-	if (likely(err == 0))
+	if (likely(err == 0)) {
 		inet6addr_notifier_call_chain(NETDEV_UP, ifa);
-	else {
+	} else {
 		kfree(ifa);
 		ifa = ERR_PTR(err);
 	}
@@ -979,9 +979,9 @@ cleanup_prefix_route(struct inet6_ifaddr *ifp, unsigned long expires, bool del_r
 				       ifp->idev->dev,
 				       0, RTF_GATEWAY | RTF_DEFAULT);
 	if (rt) {
-		if (del_rt)
+		if (del_rt) {
 			ip6_del_rt(rt);
-		else {
+		} else {
 			if (!(rt->rt6i_flags & RTF_EXPIRES))
 				rt6_set_expires(rt, expires);
 			ip6_rt_put(rt);
@@ -1037,10 +1037,9 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp)
 
 	inet6addr_notifier_call_chain(NETDEV_DOWN, ifp);
 
-	if (action != CLEANUP_PREFIX_RT_NOP) {
+	if (action != CLEANUP_PREFIX_RT_NOP)
 		cleanup_prefix_route(ifp, expires,
 			action == CLEANUP_PREFIX_RT_DEL);
-	}
 
 	/* clean up prefsrc entries */
 	rt6_remove_prefsrc(ifp);
diff --git a/net/ipv6/addrconf_core.c b/net/ipv6/addrconf_core.c
index e696045..cfa6739 100644
--- a/net/ipv6/addrconf_core.c
+++ b/net/ipv6/addrconf_core.c
@@ -40,12 +40,11 @@ int __ipv6_addr_type(const struct in6_addr *addr)
 		return (IPV6_ADDR_UNICAST |
 			IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_GLOBAL));
 
-	if ((st & htonl(0xFF000000)) == htonl(0xFF000000)) {
+	if ((st & htonl(0xFF000000)) == htonl(0xFF000000))
 		/* multicast */
 		/* addr-select 3.1 */
 		return (IPV6_ADDR_MULTICAST |
 			ipv6_addr_scope2type(IPV6_ADDR_MC_SCOPE(addr)));
-	}
 
 	if ((st & htonl(0xFFC00000)) == htonl(0xFE800000))
 		return (IPV6_ADDR_LINKLOCAL | IPV6_ADDR_UNICAST |
diff --git a/net/ipv6/exthdrs_core.c b/net/ipv6/exthdrs_core.c
index 2f2945d..4ffc04f 100644
--- a/net/ipv6/exthdrs_core.c
+++ b/net/ipv6/exthdrs_core.c
@@ -264,9 +264,9 @@ int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
 			if (flags && (*flags & IP6_FH_F_AUTH) && (target < 0))
 				break;
 			hdrlen = (hp->hdrlen + 2) << 2;
-		} else
+		} else {
 			hdrlen = ipv6_optlen(hp);
-
+		}
 		if (!found) {
 			nexthdr = hp->nexthdr;
 			len -= hdrlen;
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index 76b7f5e..17aceb6 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -334,9 +334,9 @@ static int fib6_dump_table(struct fib6_table *table, struct sk_buff *skb,
 			w->state = FWS_INIT;
 			w->node = w->root;
 			w->skip = w->count;
-		} else
+		} else {
 			w->skip = 0;
-
+		}
 		read_lock_bh(&table->tb6_lock);
 		res = fib6_walk_continue(w);
 		read_unlock_bh(&table->tb6_lock);
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
index 36da541..c99a031 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -162,9 +162,8 @@ static void ip6_fl_gc(unsigned long dummy)
 	}
 	if (!sched && atomic_read(&fl_size))
 		sched = now + FL_MAX_LINGER;
-	if (sched) {
+	if (sched)
 		mod_timer(&ip6_fl_gc_timer, sched);
-	}
 	spin_unlock(&ip6_fl_lock);
 }
 
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index 5f19dfb..7f9283f 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -1124,8 +1124,9 @@ static int ip6gre_tunnel_ioctl(struct net_device *dev,
 			ip6gre_tnl_parm_to_user(&p, &t->parms);
 			if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p)))
 				err = -EFAULT;
-		} else
+		} else {
 			err = (cmd == SIOCADDTUNNEL ? -ENOBUFS : -ENOENT);
+		}
 		break;
 
 	case SIOCDELTUNNEL:
@@ -1339,7 +1340,6 @@ static int __net_init ip6gre_init_net(struct net *net)
 	 */
 	ign->fb_tunnel_dev->features |= NETIF_F_NETNS_LOCAL;
 
-
 	ip6gre_fb_tunnel_init(ign->fb_tunnel_dev);
 	ign->fb_tunnel_dev->rtnl_link_ops = &ip6gre_link_ops;
 
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
index aacdcb4..ba3a7f8 100644
--- a/net/ipv6/ip6_input.c
+++ b/net/ipv6/ip6_input.c
@@ -338,25 +338,22 @@ int ip6_mc_input(struct sk_buff *skb)
 			/* unknown RA - process it normally */
 		}
 
-		if (deliver)
+		if (deliver) {
 			skb2 = skb_clone(skb, GFP_ATOMIC);
-		else {
+		} else {
 			skb2 = skb;
 			skb = NULL;
 		}
 
-		if (skb2) {
+		if (skb2)
 			ip6_mr_input(skb2);
-		}
 	}
 out:
 #endif
 	if (likely(deliver))
 		ip6_input(skb);
-	else {
-		/* discard */
-		kfree_skb(skb);
-	}
+	else
+		kfree_skb(skb); /* discard */
 
 	return 0;
 }
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 86fc687..5e520f2 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -275,9 +275,9 @@ static int ip6_forward_proxy_check(struct sk_buff *skb)
 		offset = ipv6_skip_exthdr(skb, sizeof(*hdr), &nexthdr, &frag_off);
 		if (offset < 0)
 			return 0;
-	} else
+	} else {
 		offset = sizeof(struct ipv6hdr);
-
+	}
 	if (nexthdr == IPPROTO_ICMPV6) {
 		struct icmp6hdr *icmp6;
 
@@ -388,7 +388,7 @@ int ip6_forward(struct sk_buff *skb)
 	/*
 	 *	We DO NOT make any processing on
 	 *	RA packets, pushing them to user level AS IS
-	 *	without ane WARRANTY that application will be able
+	 *	without any WARRANTY that application will be able
 	 *	to interpret them. The reason is that we
 	 *	cannot make anything clever here.
 	 *
@@ -741,16 +741,15 @@ slow_path:
 	/*
 	 *	Keep copying data until we run out.
 	 */
-	while (left > 0)	{
+	while (left > 0) {
 		len = left;
 		/* IF: it doesn't fit, use 'mtu' - the data space left */
 		if (len > mtu)
 			len = mtu;
 		/* IF: we are not sending up to and including the packet end
 		   then align the next start on an eight byte boundary */
-		if (len < left)	{
+		if (len < left)
 			len &= ~7;
-		}
 		/*
 		 *	Allocate buffer.
 		 */
@@ -795,9 +794,9 @@ slow_path:
 		if (!frag_id) {
 			ipv6_select_ident(fh, rt);
 			frag_id = fh->identification;
-		} else
+		} else {
 			fh->identification = frag_id;
-
+		}
 		/*
 		 *	Copy a block of the IP datagram.
 		 */
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index b38cc18..488f0dc 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -1362,9 +1362,8 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 			memset(&p, 0, sizeof(p));
 		}
 		ip6_tnl_parm_to_user(&p, &t->parms);
-		if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p))) {
+		if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p)))
 			err = -EFAULT;
-		}
 		break;
 	case SIOCADDTUNNEL:
 	case SIOCCHGTUNNEL:
@@ -1640,8 +1639,9 @@ static int ip6_tnl_changelink(struct net_device *dev, struct nlattr *tb[],
 	if (t) {
 		if (t->dev != dev)
 			return -EEXIST;
-	} else
+	} else {
 		t = netdev_priv(dev);
+	}
 
 	return ip6_tnl_update(t, &p);
 }
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 0171f08..ea054d5 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -853,8 +853,9 @@ static void ip6mr_destroy_unres(struct mr6_table *mrt, struct mfc6_cache *c)
 			skb_trim(skb, nlh->nlmsg_len);
 			((struct nlmsgerr *)nlmsg_data(nlh))->error = -ETIMEDOUT;
 			rtnl_unicast(skb, net, NETLINK_CB(skb).portid);
-		} else
+		} else {
 			kfree_skb(skb);
+		}
 	}
 
 	ip6mr_cache_free(c);
@@ -1116,8 +1117,9 @@ static void ip6mr_cache_resolve(struct net *net, struct mr6_table *mrt,
 				((struct nlmsgerr *)nlmsg_data(nlh))->error = -EMSGSIZE;
 			}
 			rtnl_unicast(skb, net, NETLINK_CB(skb).portid);
-		} else
+		} else {
 			ip6_mr_forward(net, mrt, skb, c);
+		}
 	}
 }
 
@@ -1591,9 +1593,9 @@ static int ip6mr_sk_init(struct mr6_table *mrt, struct sock *sk)
 		inet6_netconf_notify_devconf(net, NETCONFA_MC_FORWARDING,
 					     NETCONFA_IFINDEX_ALL,
 					     net->ipv6.devconf_all);
-	}
-	else
+	} else {
 		err = -EADDRINUSE;
+	}
 	write_unlock_bh(&mrt_lock);
 
 	rtnl_unlock();
@@ -2406,8 +2408,7 @@ static int mr6_msgsize(bool unresolved, int maxvif)
 		      + nla_total_size(0)	/* RTA_MULTIPATH */
 		      + maxvif * NLA_ALIGN(sizeof(struct rtnexthop))
 						/* RTA_MFC_STATS */
-		      + nla_total_size(sizeof(struct rta_mfc_stats))
-		;
+		      + nla_total_size(sizeof(struct rta_mfc_stats));
 
 	return len;
 }
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index e1a9583..8811f84 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -129,14 +129,15 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
 	int val, valbool;
 	int retv = -ENOPROTOOPT;
 
-	if (optval == NULL)
+	if (optval == NULL) {
 		val = 0;
-	else {
+	} else {
 		if (optlen >= sizeof(int)) {
 			if (get_user(val, (int __user *) optval))
 				return -EFAULT;
-		} else
+		} else {
 			val = 0;
+		}
 	}
 
 	valbool = (val != 0);
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index 7088179..2eb811e 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -180,9 +180,9 @@ int ipv6_sock_mc_join(struct sock *sk, int ifindex, const struct in6_addr *addr)
 			dev = rt->dst.dev;
 			ip6_rt_put(rt);
 		}
-	} else
+	} else {
 		dev = dev_get_by_index_rcu(net, ifindex);
-
+	}
 	if (dev == NULL) {
 		rcu_read_unlock();
 		sock_kfree_s(sk, mc_lst, sizeof(*mc_lst));
@@ -277,9 +277,9 @@ static struct inet6_dev *ip6_mc_find_dev_rcu(struct net *net,
 			dev = rt->dst.dev;
 			ip6_rt_put(rt);
 		}
-	} else
+	} else {
 		dev = dev_get_by_index_rcu(net, ifindex);
-
+	}
 	if (!dev)
 		return NULL;
 	idev = __in6_dev_get(dev);
@@ -318,8 +318,9 @@ void ipv6_sock_mc_close(struct sock *sk)
 			(void) ip6_mc_leave_src(sk, mc_lst, idev);
 			if (idev)
 				__ipv6_dev_mc_dec(idev, &mc_lst->addr);
-		} else
+		} else {
 			(void) ip6_mc_leave_src(sk, mc_lst, NULL);
+		}
 		rcu_read_unlock();
 
 		atomic_sub(sizeof(*mc_lst), &sk->sk_omem_alloc);
@@ -537,8 +538,9 @@ int ip6_mc_msfilter(struct sock *sk, struct group_filter *gsf)
 		(void) ip6_mc_del_src(idev, group, pmc->sfmode,
 			psl->sl_count, psl->sl_addr, 0);
 		sock_kfree_s(sk, psl, IP6_SFLSIZE(psl->sl_max));
-	} else
+	} else {
 		(void) ip6_mc_del_src(idev, group, pmc->sfmode, 0, NULL, 0);
+	}
 	pmc->sflist = newpsl;
 	pmc->sfmode = gsf->gf_fmode;
 	write_unlock(&pmc->sflock);
@@ -1359,9 +1361,9 @@ int igmp6_event_query(struct sk_buff *skb)
 			mlh2 = (struct mld2_query *)skb_transport_header(skb);
 			mark = 1;
 		}
-	} else
+	} else {
 		return -EINVAL;
-
+	}
 	read_lock_bh(&idev->lock);
 	if (group_type == IPV6_ADDR_ANY) {
 		for (ma = idev->mc_list; ma; ma = ma->next) {
@@ -1832,8 +1834,9 @@ static void mld_clear_zeros(struct ip6_sf_list **ppsf)
 			else
 				*ppsf = psf->sf_next;
 			kfree(psf);
-		} else
+		} else {
 			psf_prev = psf;
+		}
 	}
 }
 
@@ -1875,8 +1878,9 @@ static void mld_send_cr(struct inet6_dev *idev)
 				idev->mc_tomb = pmc_next;
 			in6_dev_put(pmc->idev);
 			kfree(pmc);
-		} else
+		} else {
 			pmc_prev = pmc;
+		}
 	}
 	spin_unlock(&idev->mc_lock);
 
@@ -1960,9 +1964,9 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)
 		 * when a valid link-local address is not available.
 		 */
 		saddr = &in6addr_any;
-	} else
+	} else {
 		saddr = &addr_buf;
-
+	}
 	ip6_mc_hdr(sk, skb, dev, saddr, snd_addr, NEXTHDR_HOP, payload_len);
 
 	memcpy(skb_put(skb, sizeof(ra)), ra, sizeof(ra));
@@ -1996,9 +2000,9 @@ out:
 		ICMP6MSGOUT_INC_STATS(net, idev, type);
 		ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTMSGS);
 		IP6_UPD_PO_STATS(net, idev, IPSTATS_MIB_OUTMCAST, full_len);
-	} else
+	} else {
 		IP6_INC_STATS(net, idev, IPSTATS_MIB_OUTDISCARDS);
-
+	}
 	rcu_read_unlock();
 	return;
 
@@ -2087,8 +2091,9 @@ static int ip6_mc_del1_src(struct ifmcaddr6 *pmc, int sfmode,
 			psf->sf_next = pmc->mca_tomb;
 			pmc->mca_tomb = psf;
 			rv = 1;
-		} else
+		} else {
 			kfree(psf);
+		}
 	}
 	return rv;
 }
@@ -2143,8 +2148,9 @@ static int ip6_mc_del_src(struct inet6_dev *idev, const struct in6_addr *pmca,
 		for (psf = pmc->mca_sources; psf; psf = psf->sf_next)
 			psf->sf_crcount = 0;
 		mld_ifc_event(pmc->idev);
-	} else if (sf_setstate(pmc) || changerec)
+	} else if (sf_setstate(pmc) || changerec) {
 		mld_ifc_event(pmc->idev);
+	}
 	spin_unlock_bh(&pmc->mca_lock);
 	read_unlock_bh(&idev->lock);
 	return err;
@@ -2170,9 +2176,9 @@ static int ip6_mc_add1_src(struct ifmcaddr6 *pmc, int sfmode,
 			return -ENOBUFS;
 
 		psf->sf_addr = *psfsrc;
-		if (psf_prev) {
+		if (psf_prev)
 			psf_prev->sf_next = psf;
-		} else
+		else
 			pmc->mca_sources = psf;
 	}
 	psf->sf_count[sfmode]++;
@@ -2189,8 +2195,9 @@ static void sf_markstate(struct ifmcaddr6 *pmc)
 			psf->sf_oldin = mca_xcount ==
 				psf->sf_count[MCAST_EXCLUDE] &&
 				!psf->sf_count[MCAST_INCLUDE];
-		} else
+		} else {
 			psf->sf_oldin = psf->sf_count[MCAST_INCLUDE] != 0;
+		}
 }
 
 static int sf_setstate(struct ifmcaddr6 *pmc)
@@ -2311,8 +2318,9 @@ static int ip6_mc_add_src(struct inet6_dev *idev, const struct in6_addr *pmca,
 		for (psf = pmc->mca_sources; psf; psf = psf->sf_next)
 			psf->sf_crcount = 0;
 		mld_ifc_event(idev);
-	} else if (sf_setstate(pmc))
+	} else if (sf_setstate(pmc)) {
 		mld_ifc_event(idev);
+	}
 	spin_unlock_bh(&pmc->mca_lock);
 	read_unlock_bh(&idev->lock);
 	return err;
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index d0232b2..a38d730 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -303,9 +303,8 @@ static int ndisc_constructor(struct neighbour *neigh)
 	bool is_multicast = ipv6_addr_is_multicast(addr);
 
 	in6_dev = in6_dev_get(dev);
-	if (in6_dev == NULL) {
+	if (in6_dev == NULL)
 		return -EINVAL;
-	}
 
 	parms = in6_dev->nd_parms;
 	__neigh_parms_put(neigh->parms);
@@ -604,9 +603,8 @@ void ndisc_send_rs(struct net_device *dev, const struct in6_addr *saddr,
 		struct inet6_ifaddr *ifp = ipv6_get_ifaddr(dev_net(dev), saddr,
 							   dev, 1);
 		if (ifp) {
-			if (ifp->flags & IFA_F_OPTIMISTIC)  {
+			if (ifp->flags & IFA_F_OPTIMISTIC)
 				send_sllao = 0;
-			}
 			in6_ifa_put(ifp);
 		} else {
 			send_sllao = 0;
@@ -805,8 +803,9 @@ static void ndisc_recv_ns(struct sk_buff *skb)
 					pneigh_enqueue(&nd_tbl, idev->nd_parms, n);
 				goto out;
 			}
-		} else
+		} else {
 			goto out;
+		}
 	}
 
 	if (is_router < 0)
@@ -865,18 +864,15 @@ static void ndisc_recv_na(struct sk_buff *skb)
 		ND_PRINTK(2, warn, "NA: packet too short\n");
 		return;
 	}
-
 	if (ipv6_addr_is_multicast(&msg->target)) {
 		ND_PRINTK(2, warn, "NA: target address is multicast\n");
 		return;
 	}
-
 	if (ipv6_addr_is_multicast(daddr) &&
 	    msg->icmph.icmp6_solicited) {
 		ND_PRINTK(2, warn, "NA: solicited NA is multicasted\n");
 		return;
 	}
-
 	if (!ndisc_parse_options(msg->opt, ndoptlen, &ndopts)) {
 		ND_PRINTK(2, warn, "NS: invalid ND option\n");
 		return;
@@ -1026,9 +1022,8 @@ static void ndisc_ra_useropt(struct sk_buff *ra, struct nd_opt_hdr *opt)
 	}
 
 	nlh = nlmsg_put(skb, 0, 0, RTM_NEWNDUSEROPT, base_size, 0);
-	if (nlh == NULL) {
+	if (nlh == NULL)
 		goto nla_put_failure;
-	}
 
 	ndmsg = nlmsg_data(nlh);
 	ndmsg->nduseropt_family = AF_INET6;
@@ -1376,9 +1371,8 @@ skip_routeinfo:
 		}
 	}
 
-	if (ndopts.nd_opts_tgt_lladdr || ndopts.nd_opts_rh) {
+	if (ndopts.nd_opts_tgt_lladdr || ndopts.nd_opts_rh)
 		ND_PRINTK(2, warn, "RA: invalid RA options\n");
-	}
 out:
 	ip6_rt_put(rt);
 	if (neigh)
diff --git a/net/ipv6/ping.c b/net/ipv6/ping.c
index 5b7a1ed..b1274f4 100644
--- a/net/ipv6/ping.c
+++ b/net/ipv6/ping.c
@@ -103,13 +103,13 @@ int ping_v6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
 	if (msg->msg_name) {
 		DECLARE_SOCKADDR(struct sockaddr_in6 *, u, msg->msg_name);
 		if (msg->msg_namelen < sizeof(struct sockaddr_in6) ||
-		    u->sin6_family != AF_INET6) {
+		    u->sin6_family != AF_INET6)
 			return -EINVAL;
-		}
+
 		if (sk->sk_bound_dev_if &&
-		    sk->sk_bound_dev_if != u->sin6_scope_id) {
+		    sk->sk_bound_dev_if != u->sin6_scope_id)
 			return -EINVAL;
-		}
+
 		daddr = &(u->sin6_addr);
 		iif = u->sin6_scope_id;
 	} else {
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index f74b041..0b924e3 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -708,9 +708,8 @@ int rt6_route_rcv(struct net_device *dev, u8 *opt, int len,
 	unsigned long lifetime;
 	struct rt6_info *rt;
 
-	if (len < sizeof(struct route_info)) {
+	if (len < sizeof(struct route_info))
 		return -EINVAL;
-	}
 
 	/* Sanity check for prefix_len and length */
 	if (rinfo->length > 3) {
@@ -718,13 +717,11 @@ int rt6_route_rcv(struct net_device *dev, u8 *opt, int len,
 	} else if (rinfo->prefix_len > 128) {
 		return -EINVAL;
 	} else if (rinfo->prefix_len > 64) {
-		if (rinfo->length < 2) {
+		if (rinfo->length < 2)
 			return -EINVAL;
-		}
 	} else if (rinfo->prefix_len > 0) {
-		if (rinfo->length < 1) {
+		if (rinfo->length < 1)
 			return -EINVAL;
-		}
 	}
 
 	pref = rinfo->route_pref;
@@ -733,9 +730,9 @@ int rt6_route_rcv(struct net_device *dev, u8 *opt, int len,
 
 	lifetime = addrconf_timeout_fixup(ntohl(rinfo->lifetime), HZ);
 
-	if (rinfo->length == 3)
+	if (rinfo->length == 3) {
 		prefix = (struct in6_addr *)rinfo->prefix;
-	else {
+	} else {
 		/* this function is safe */
 		ipv6_addr_prefix(&prefix_buf,
 				 (struct in6_addr *)rinfo->prefix,
@@ -2578,13 +2575,13 @@ static int rt6_fill_node(struct net *net,
 			rtm->rtm_type = RTN_UNREACHABLE;
 			break;
 		}
-	}
-	else if (rt->rt6i_flags & RTF_LOCAL)
+	} else if (rt->rt6i_flags & RTF_LOCAL) {
 		rtm->rtm_type = RTN_LOCAL;
-	else if (rt->dst.dev && (rt->dst.dev->flags & IFF_LOOPBACK))
+	} else if (rt->dst.dev && (rt->dst.dev->flags & IFF_LOOPBACK)) {
 		rtm->rtm_type = RTN_LOCAL;
-	else
+	} else {
 		rtm->rtm_type = RTN_UNICAST;
+	}
 	rtm->rtm_flags = 0;
 	rtm->rtm_scope = RT_SCOPE_UNIVERSE;
 	rtm->rtm_protocol = rt->rt6i_protocol;
@@ -2682,9 +2679,9 @@ int rt6_dump_route(struct rt6_info *rt, void *p_arg)
 	if (nlmsg_len(arg->cb->nlh) >= sizeof(struct rtmsg)) {
 		struct rtmsg *rtm = nlmsg_data(arg->cb->nlh);
 		prefix = (rtm->rtm_flags & RTM_F_PREFIX) != 0;
-	} else
+	} else {
 		prefix = 0;
-
+	}
 	return rt6_fill_node(arg->net,
 		     arg->skb, rt, NULL, NULL, 0, RTM_NEWROUTE,
 		     NETLINK_CB(arg->cb->skb).portid, arg->cb->nlh->nlmsg_seq,
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 29964c3..2790300 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -454,16 +454,18 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
 			sk->sk_error_report(sk);		/* Wake people up to see the error (see connect in sock.c) */
 
 			tcp_done(sk);
-		} else
+		} else {
 			sk->sk_err_soft = err;
+		}
 		goto out;
 	}
 
 	if (!sock_owned_by_user(sk) && np->recverr) {
 		sk->sk_err = err;
 		sk->sk_error_report(sk);
-	} else
+	} else {
 		sk->sk_err_soft = err;
+	}
 
 out:
 	bh_unlock_sock(sk);
@@ -1323,9 +1325,9 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb)
 				__kfree_skb(opt_skb);
 			return 0;
 		}
-	} else
+	} else {
 		sock_rps_save_rxhash(sk, skb);
-
+	}
 	if (tcp_rcv_state_process(sk, skb, tcp_hdr(skb), skb->len))
 		goto reset;
 	if (opt_skb)
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index e06d460..d59c723 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -424,10 +424,10 @@ try_again:
 			goto csum_copy_err;
 	}
 
-	if (skb_csum_unnecessary(skb))
+	if (skb_csum_unnecessary(skb)) {
 		err = skb_copy_datagram_iovec(skb, sizeof(struct udphdr),
 					      msg->msg_iov, copied);
-	else {
+	} else {
 		err = skb_copy_and_csum_datagram_iovec(skb, sizeof(struct udphdr), msg->msg_iov);
 		if (err == -EINVAL)
 			goto csum_copy_err;
@@ -488,7 +488,6 @@ try_again:
 		if (np->rxopt.all)
 			ip6_datagram_recv_specific_ctl(sk, msg, skb);
 	}
-
 	err = copied;
 	if (flags & MSG_TRUNC)
 		err = ulen;
@@ -819,11 +818,10 @@ start_lookup:
 		goto start_lookup;
 	}
 
-	if (count) {
+	if (count)
 		flush_stack(stack, count, skb, count - 1);
-	} else {
+	else
 		kfree_skb(skb);
-	}
 	return 0;
 }
 
@@ -1061,9 +1059,10 @@ send:
 					    UDP_MIB_SNDBUFERRORS, is_udplite);
 			err = 0;
 		}
-	} else
+	} else {
 		UDP6_INC_STATS_USER(sock_net(sk),
 				    UDP_MIB_OUTDATAGRAMS, is_udplite);
+	}
 out:
 	up->len = 0;
 	up->pending = 0;
@@ -1119,9 +1118,9 @@ int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk,
 		if (sk->sk_state != TCP_ESTABLISHED)
 			return -EDESTADDRREQ;
 		daddr = &sk->sk_v6_daddr;
-	} else
+	} else {
 		daddr = NULL;
-
+	}
 	if (daddr) {
 		if (ipv6_addr_v4mapped(daddr)) {
 			struct sockaddr_in sin;
@@ -1453,7 +1452,8 @@ int __net_init udp6_proc_init(struct net *net)
 	return udp_proc_register(net, &udp6_seq_afinfo);
 }
 
-void udp6_proc_exit(struct net *net) {
+void udp6_proc_exit(struct net *net)
+{
 	udp_proc_unregister(net, &udp6_seq_afinfo);
 }
 #endif /* CONFIG_PROC_FS */
diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c
index ca3f29b..f9f745d 100644
--- a/net/ipv6/xfrm6_output.c
+++ b/net/ipv6/xfrm6_output.c
@@ -159,9 +159,9 @@ static int __xfrm6_output(struct sk_buff *skb)
 
 	if (x->props.mode == XFRM_MODE_TUNNEL &&
 	    ((skb->len > mtu && !skb_is_gso(skb)) ||
-		dst_allfrag(skb_dst(skb)))) {
+		dst_allfrag(skb_dst(skb))))
 			return ip6_fragment(skb, x->outer_mode->afinfo->output_finish);
-	}
+
 	return x->outer_mode->afinfo->output_finish(skb);
 }
 
diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c
index 5743044..2965098 100644
--- a/net/ipv6/xfrm6_tunnel.c
+++ b/net/ipv6/xfrm6_tunnel.c
@@ -180,8 +180,9 @@ __be32 xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr)
 	if (x6spi) {
 		atomic_inc(&x6spi->refcnt);
 		spi = x6spi->spi;
-	} else
+	} else {
 		spi = __xfrm6_tunnel_alloc_spi(net, saddr);
+	}
 	spin_unlock_bh(&xfrm6_tunnel_spi_lock);
 
 	return htonl(spi);
-- 
1.7.9.5

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

* Re: [PATCH net-next 2/4] ipv6: coding style - min to min_t conversion
  2014-09-02 19:16 ` [PATCH net-next 2/4] ipv6: coding style - min to min_t conversion Ian Morris
@ 2014-09-03  1:29   ` YOSHIFUJI Hideaki
  0 siblings, 0 replies; 10+ messages in thread
From: YOSHIFUJI Hideaki @ 2014-09-03  1:29 UTC (permalink / raw)
  To: Ian Morris, netdev; +Cc: hideaki.yoshifuji, YOSHIFUJI Hideaki

Hi,

Ian Morris wrote:
> This patch changes a min to min_t as per checkpatch recomendation.
> 
> No change in the object output is detected by the objdiff script.
> 
> Signed-off-by: Ian Morris <ipm@chirality.org.uk>
> ---
>   net/ipv6/addrconf.c |    7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> index 509c53e..23d8493 100644
> --- a/net/ipv6/addrconf.c
> +++ b/net/ipv6/addrconf.c
> @@ -2320,8 +2320,11 @@ ok:
>   			else
>   				stored_lft = 0;
>   			if (!update_lft && !create && stored_lft) {
> -				const u32 minimum_lft = min(
> -					stored_lft, (u32)MIN_VALID_LIFETIME);
> +				const u32 minimum_lft = min_t(
> +							  u32,
> +							  stored_lft,
> +							  MIN_VALID_LIFETIME);
> +
>   				valid_lft = max(valid_lft, minimum_lft);
>   
>   				/* RFC4862 Section 5.5.3e:
> 

Please put 1st argument(u32) at the first line and make arguments aligned.

-- 
Hideaki Yoshifuji <hideaki.yoshifuji@miraclelinux.com>
Technical Division, MIRACLE LINUX CORPORATION

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

* Re: [PATCH net-next 4/4] ipv6: coding style - cleanse bracing
  2014-09-02 19:16 ` [PATCH net-next 4/4] ipv6: coding style - cleanse bracing Ian Morris
@ 2014-09-03  1:31   ` YOSHIFUJI Hideaki/吉藤英明
  2014-09-03  7:52     ` Yuval Mintz
  0 siblings, 1 reply; 10+ messages in thread
From: YOSHIFUJI Hideaki/吉藤英明 @ 2014-09-03  1:31 UTC (permalink / raw)
  To: Ian Morris, netdev; +Cc: hideaki.yoshifuji, YOSHIFUJI Hideaki

Hi,

Ian Morris wrote:
> Tidy up braces in a few places (mainly if statements):
> * remove unnecessary braces
> * add braces for single line statements where part of an "else" where the other branch has braces

Hmm, I am not for this change.

If "if" (or "else") statement occupies multiple lines, I want to see
braces even if it contains a single statement.
On the other hand, especiallly if the statement occupiles only one line
(and the logic do not require those braces), no braces.

e.g. 1
    if (cond)
            statement();
    else {
            statement2(argument,
                       argument2);
    }
e.g. 2
    if (cond) {
            if (cond2)
                    statement();
    } else
            statement2(argument, argument2);

e.g. 3
    if (cond) {
            /* comment */
            statement();
    }

> 
> No change in the object output is detected by the objdiff script.
> 
> Signed-off-by: Ian Morris <ipm@chirality.org.uk>
> ---
>   net/ipv6/addrconf.c      |   11 +++++------
>   net/ipv6/addrconf_core.c |    3 +--
>   net/ipv6/exthdrs_core.c  |    4 ++--
>   net/ipv6/ip6_fib.c       |    4 ++--
>   net/ipv6/ip6_flowlabel.c |    3 +--
>   net/ipv6/ip6_gre.c       |    4 ++--
>   net/ipv6/ip6_input.c     |   13 +++++--------
>   net/ipv6/ip6_output.c    |   15 +++++++--------
>   net/ipv6/ip6_tunnel.c    |    6 +++---
>   net/ipv6/ip6mr.c         |   13 +++++++------
>   net/ipv6/ipv6_sockglue.c |    7 ++++---
>   net/ipv6/mcast.c         |   48 +++++++++++++++++++++++++++-------------------
>   net/ipv6/ndisc.c         |   18 ++++++-----------
>   net/ipv6/ping.c          |    8 ++++----
>   net/ipv6/route.c         |   25 +++++++++++-------------
>   net/ipv6/tcp_ipv6.c      |   10 ++++++----
>   net/ipv6/udp.c           |   20 +++++++++----------
>   net/ipv6/xfrm6_output.c  |    4 ++--
>   net/ipv6/xfrm6_tunnel.c  |    3 ++-
>   19 files changed, 108 insertions(+), 111 deletions(-)
> 
> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> index 23d8493..f31a204 100644
> --- a/net/ipv6/addrconf.c
> +++ b/net/ipv6/addrconf.c
> @@ -895,9 +895,9 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr,
>   out2:
>   	rcu_read_unlock_bh();
>   
> -	if (likely(err == 0))
> +	if (likely(err == 0)) {
>   		inet6addr_notifier_call_chain(NETDEV_UP, ifa);
> -	else {
> +	} else {
>   		kfree(ifa);
>   		ifa = ERR_PTR(err);
>   	}
> @@ -979,9 +979,9 @@ cleanup_prefix_route(struct inet6_ifaddr *ifp, unsigned long expires, bool del_r
>   				       ifp->idev->dev,
>   				       0, RTF_GATEWAY | RTF_DEFAULT);
>   	if (rt) {
> -		if (del_rt)
> +		if (del_rt) {
>   			ip6_del_rt(rt);
> -		else {
> +		} else {
>   			if (!(rt->rt6i_flags & RTF_EXPIRES))
>   				rt6_set_expires(rt, expires);
>   			ip6_rt_put(rt);
> @@ -1037,10 +1037,9 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp)
>   
>   	inet6addr_notifier_call_chain(NETDEV_DOWN, ifp);
>   
> -	if (action != CLEANUP_PREFIX_RT_NOP) {
> +	if (action != CLEANUP_PREFIX_RT_NOP)
>   		cleanup_prefix_route(ifp, expires,
>   			action == CLEANUP_PREFIX_RT_DEL);
> -	}
>   
>   	/* clean up prefsrc entries */
>   	rt6_remove_prefsrc(ifp);
> diff --git a/net/ipv6/addrconf_core.c b/net/ipv6/addrconf_core.c
> index e696045..cfa6739 100644
> --- a/net/ipv6/addrconf_core.c
> +++ b/net/ipv6/addrconf_core.c
> @@ -40,12 +40,11 @@ int __ipv6_addr_type(const struct in6_addr *addr)
>   		return (IPV6_ADDR_UNICAST |
>   			IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_GLOBAL));
>   
> -	if ((st & htonl(0xFF000000)) == htonl(0xFF000000)) {
> +	if ((st & htonl(0xFF000000)) == htonl(0xFF000000))
>   		/* multicast */
>   		/* addr-select 3.1 */
>   		return (IPV6_ADDR_MULTICAST |
>   			ipv6_addr_scope2type(IPV6_ADDR_MC_SCOPE(addr)));
> -	}
>   
>   	if ((st & htonl(0xFFC00000)) == htonl(0xFE800000))
>   		return (IPV6_ADDR_LINKLOCAL | IPV6_ADDR_UNICAST |
> diff --git a/net/ipv6/exthdrs_core.c b/net/ipv6/exthdrs_core.c
> index 2f2945d..4ffc04f 100644
> --- a/net/ipv6/exthdrs_core.c
> +++ b/net/ipv6/exthdrs_core.c
> @@ -264,9 +264,9 @@ int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
>   			if (flags && (*flags & IP6_FH_F_AUTH) && (target < 0))
>   				break;
>   			hdrlen = (hp->hdrlen + 2) << 2;
> -		} else
> +		} else {
>   			hdrlen = ipv6_optlen(hp);
> -
> +		}
>   		if (!found) {
>   			nexthdr = hp->nexthdr;
>   			len -= hdrlen;
> diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
> index 76b7f5e..17aceb6 100644
> --- a/net/ipv6/ip6_fib.c
> +++ b/net/ipv6/ip6_fib.c
> @@ -334,9 +334,9 @@ static int fib6_dump_table(struct fib6_table *table, struct sk_buff *skb,
>   			w->state = FWS_INIT;
>   			w->node = w->root;
>   			w->skip = w->count;
> -		} else
> +		} else {
>   			w->skip = 0;
> -
> +		}
>   		read_lock_bh(&table->tb6_lock);
>   		res = fib6_walk_continue(w);
>   		read_unlock_bh(&table->tb6_lock);
> diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
> index 36da541..c99a031 100644
> --- a/net/ipv6/ip6_flowlabel.c
> +++ b/net/ipv6/ip6_flowlabel.c
> @@ -162,9 +162,8 @@ static void ip6_fl_gc(unsigned long dummy)
>   	}
>   	if (!sched && atomic_read(&fl_size))
>   		sched = now + FL_MAX_LINGER;
> -	if (sched) {
> +	if (sched)
>   		mod_timer(&ip6_fl_gc_timer, sched);
> -	}
>   	spin_unlock(&ip6_fl_lock);
>   }
>   
> diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
> index 5f19dfb..7f9283f 100644
> --- a/net/ipv6/ip6_gre.c
> +++ b/net/ipv6/ip6_gre.c
> @@ -1124,8 +1124,9 @@ static int ip6gre_tunnel_ioctl(struct net_device *dev,
>   			ip6gre_tnl_parm_to_user(&p, &t->parms);
>   			if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p)))
>   				err = -EFAULT;
> -		} else
> +		} else {
>   			err = (cmd == SIOCADDTUNNEL ? -ENOBUFS : -ENOENT);
> +		}
>   		break;
>   
>   	case SIOCDELTUNNEL:
> @@ -1339,7 +1340,6 @@ static int __net_init ip6gre_init_net(struct net *net)
>   	 */
>   	ign->fb_tunnel_dev->features |= NETIF_F_NETNS_LOCAL;
>   
> -
>   	ip6gre_fb_tunnel_init(ign->fb_tunnel_dev);
>   	ign->fb_tunnel_dev->rtnl_link_ops = &ip6gre_link_ops;
>   
> diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
> index aacdcb4..ba3a7f8 100644
> --- a/net/ipv6/ip6_input.c
> +++ b/net/ipv6/ip6_input.c
> @@ -338,25 +338,22 @@ int ip6_mc_input(struct sk_buff *skb)
>   			/* unknown RA - process it normally */
>   		}
>   
> -		if (deliver)
> +		if (deliver) {
>   			skb2 = skb_clone(skb, GFP_ATOMIC);
> -		else {
> +		} else {
>   			skb2 = skb;
>   			skb = NULL;
>   		}
>   
> -		if (skb2) {
> +		if (skb2)
>   			ip6_mr_input(skb2);
> -		}
>   	}
>   out:
>   #endif
>   	if (likely(deliver))
>   		ip6_input(skb);
> -	else {
> -		/* discard */
> -		kfree_skb(skb);
> -	}
> +	else
> +		kfree_skb(skb); /* discard */
>   
>   	return 0;
>   }
> diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
> index 86fc687..5e520f2 100644
> --- a/net/ipv6/ip6_output.c
> +++ b/net/ipv6/ip6_output.c
> @@ -275,9 +275,9 @@ static int ip6_forward_proxy_check(struct sk_buff *skb)
>   		offset = ipv6_skip_exthdr(skb, sizeof(*hdr), &nexthdr, &frag_off);
>   		if (offset < 0)
>   			return 0;
> -	} else
> +	} else {
>   		offset = sizeof(struct ipv6hdr);
> -
> +	}
>   	if (nexthdr == IPPROTO_ICMPV6) {
>   		struct icmp6hdr *icmp6;
>   
> @@ -388,7 +388,7 @@ int ip6_forward(struct sk_buff *skb)
>   	/*
>   	 *	We DO NOT make any processing on
>   	 *	RA packets, pushing them to user level AS IS
> -	 *	without ane WARRANTY that application will be able
> +	 *	without any WARRANTY that application will be able
>   	 *	to interpret them. The reason is that we
>   	 *	cannot make anything clever here.
>   	 *
> @@ -741,16 +741,15 @@ slow_path:
>   	/*
>   	 *	Keep copying data until we run out.
>   	 */
> -	while (left > 0)	{
> +	while (left > 0) {
>   		len = left;
>   		/* IF: it doesn't fit, use 'mtu' - the data space left */
>   		if (len > mtu)
>   			len = mtu;
>   		/* IF: we are not sending up to and including the packet end
>   		   then align the next start on an eight byte boundary */
> -		if (len < left)	{
> +		if (len < left)
>   			len &= ~7;
> -		}
>   		/*
>   		 *	Allocate buffer.
>   		 */
> @@ -795,9 +794,9 @@ slow_path:
>   		if (!frag_id) {
>   			ipv6_select_ident(fh, rt);
>   			frag_id = fh->identification;
> -		} else
> +		} else {
>   			fh->identification = frag_id;
> -
> +		}
>   		/*
>   		 *	Copy a block of the IP datagram.
>   		 */
> diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
> index b38cc18..488f0dc 100644
> --- a/net/ipv6/ip6_tunnel.c
> +++ b/net/ipv6/ip6_tunnel.c
> @@ -1362,9 +1362,8 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
>   			memset(&p, 0, sizeof(p));
>   		}
>   		ip6_tnl_parm_to_user(&p, &t->parms);
> -		if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p))) {
> +		if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p)))
>   			err = -EFAULT;
> -		}
>   		break;
>   	case SIOCADDTUNNEL:
>   	case SIOCCHGTUNNEL:
> @@ -1640,8 +1639,9 @@ static int ip6_tnl_changelink(struct net_device *dev, struct nlattr *tb[],
>   	if (t) {
>   		if (t->dev != dev)
>   			return -EEXIST;
> -	} else
> +	} else {
>   		t = netdev_priv(dev);
> +	}
>   
>   	return ip6_tnl_update(t, &p);
>   }
> diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
> index 0171f08..ea054d5 100644
> --- a/net/ipv6/ip6mr.c
> +++ b/net/ipv6/ip6mr.c
> @@ -853,8 +853,9 @@ static void ip6mr_destroy_unres(struct mr6_table *mrt, struct mfc6_cache *c)
>   			skb_trim(skb, nlh->nlmsg_len);
>   			((struct nlmsgerr *)nlmsg_data(nlh))->error = -ETIMEDOUT;
>   			rtnl_unicast(skb, net, NETLINK_CB(skb).portid);
> -		} else
> +		} else {
>   			kfree_skb(skb);
> +		}
>   	}
>   
>   	ip6mr_cache_free(c);
> @@ -1116,8 +1117,9 @@ static void ip6mr_cache_resolve(struct net *net, struct mr6_table *mrt,
>   				((struct nlmsgerr *)nlmsg_data(nlh))->error = -EMSGSIZE;
>   			}
>   			rtnl_unicast(skb, net, NETLINK_CB(skb).portid);
> -		} else
> +		} else {
>   			ip6_mr_forward(net, mrt, skb, c);
> +		}
>   	}
>   }
>   
> @@ -1591,9 +1593,9 @@ static int ip6mr_sk_init(struct mr6_table *mrt, struct sock *sk)
>   		inet6_netconf_notify_devconf(net, NETCONFA_MC_FORWARDING,
>   					     NETCONFA_IFINDEX_ALL,
>   					     net->ipv6.devconf_all);
> -	}
> -	else
> +	} else {
>   		err = -EADDRINUSE;
> +	}
>   	write_unlock_bh(&mrt_lock);
>   
>   	rtnl_unlock();
> @@ -2406,8 +2408,7 @@ static int mr6_msgsize(bool unresolved, int maxvif)
>   		      + nla_total_size(0)	/* RTA_MULTIPATH */
>   		      + maxvif * NLA_ALIGN(sizeof(struct rtnexthop))
>   						/* RTA_MFC_STATS */
> -		      + nla_total_size(sizeof(struct rta_mfc_stats))
> -		;
> +		      + nla_total_size(sizeof(struct rta_mfc_stats));
>   
>   	return len;
>   }
> diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
> index e1a9583..8811f84 100644
> --- a/net/ipv6/ipv6_sockglue.c
> +++ b/net/ipv6/ipv6_sockglue.c
> @@ -129,14 +129,15 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
>   	int val, valbool;
>   	int retv = -ENOPROTOOPT;
>   
> -	if (optval == NULL)
> +	if (optval == NULL) {
>   		val = 0;
> -	else {
> +	} else {
>   		if (optlen >= sizeof(int)) {
>   			if (get_user(val, (int __user *) optval))
>   				return -EFAULT;
> -		} else
> +		} else {
>   			val = 0;
> +		}
>   	}
>   
>   	valbool = (val != 0);
> diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
> index 7088179..2eb811e 100644
> --- a/net/ipv6/mcast.c
> +++ b/net/ipv6/mcast.c
> @@ -180,9 +180,9 @@ int ipv6_sock_mc_join(struct sock *sk, int ifindex, const struct in6_addr *addr)
>   			dev = rt->dst.dev;
>   			ip6_rt_put(rt);
>   		}
> -	} else
> +	} else {
>   		dev = dev_get_by_index_rcu(net, ifindex);
> -
> +	}
>   	if (dev == NULL) {
>   		rcu_read_unlock();
>   		sock_kfree_s(sk, mc_lst, sizeof(*mc_lst));
> @@ -277,9 +277,9 @@ static struct inet6_dev *ip6_mc_find_dev_rcu(struct net *net,
>   			dev = rt->dst.dev;
>   			ip6_rt_put(rt);
>   		}
> -	} else
> +	} else {
>   		dev = dev_get_by_index_rcu(net, ifindex);
> -
> +	}
>   	if (!dev)
>   		return NULL;
>   	idev = __in6_dev_get(dev);
> @@ -318,8 +318,9 @@ void ipv6_sock_mc_close(struct sock *sk)
>   			(void) ip6_mc_leave_src(sk, mc_lst, idev);
>   			if (idev)
>   				__ipv6_dev_mc_dec(idev, &mc_lst->addr);
> -		} else
> +		} else {
>   			(void) ip6_mc_leave_src(sk, mc_lst, NULL);
> +		}
>   		rcu_read_unlock();
>   
>   		atomic_sub(sizeof(*mc_lst), &sk->sk_omem_alloc);
> @@ -537,8 +538,9 @@ int ip6_mc_msfilter(struct sock *sk, struct group_filter *gsf)
>   		(void) ip6_mc_del_src(idev, group, pmc->sfmode,
>   			psl->sl_count, psl->sl_addr, 0);
>   		sock_kfree_s(sk, psl, IP6_SFLSIZE(psl->sl_max));
> -	} else
> +	} else {
>   		(void) ip6_mc_del_src(idev, group, pmc->sfmode, 0, NULL, 0);
> +	}
>   	pmc->sflist = newpsl;
>   	pmc->sfmode = gsf->gf_fmode;
>   	write_unlock(&pmc->sflock);
> @@ -1359,9 +1361,9 @@ int igmp6_event_query(struct sk_buff *skb)
>   			mlh2 = (struct mld2_query *)skb_transport_header(skb);
>   			mark = 1;
>   		}
> -	} else
> +	} else {
>   		return -EINVAL;
> -
> +	}
>   	read_lock_bh(&idev->lock);
>   	if (group_type == IPV6_ADDR_ANY) {
>   		for (ma = idev->mc_list; ma; ma = ma->next) {
> @@ -1832,8 +1834,9 @@ static void mld_clear_zeros(struct ip6_sf_list **ppsf)
>   			else
>   				*ppsf = psf->sf_next;
>   			kfree(psf);
> -		} else
> +		} else {
>   			psf_prev = psf;
> +		}
>   	}
>   }
>   
> @@ -1875,8 +1878,9 @@ static void mld_send_cr(struct inet6_dev *idev)
>   				idev->mc_tomb = pmc_next;
>   			in6_dev_put(pmc->idev);
>   			kfree(pmc);
> -		} else
> +		} else {
>   			pmc_prev = pmc;
> +		}
>   	}
>   	spin_unlock(&idev->mc_lock);
>   
> @@ -1960,9 +1964,9 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)
>   		 * when a valid link-local address is not available.
>   		 */
>   		saddr = &in6addr_any;
> -	} else
> +	} else {
>   		saddr = &addr_buf;
> -
> +	}
>   	ip6_mc_hdr(sk, skb, dev, saddr, snd_addr, NEXTHDR_HOP, payload_len);
>   
>   	memcpy(skb_put(skb, sizeof(ra)), ra, sizeof(ra));
> @@ -1996,9 +2000,9 @@ out:
>   		ICMP6MSGOUT_INC_STATS(net, idev, type);
>   		ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTMSGS);
>   		IP6_UPD_PO_STATS(net, idev, IPSTATS_MIB_OUTMCAST, full_len);
> -	} else
> +	} else {
>   		IP6_INC_STATS(net, idev, IPSTATS_MIB_OUTDISCARDS);
> -
> +	}
>   	rcu_read_unlock();
>   	return;
>   
> @@ -2087,8 +2091,9 @@ static int ip6_mc_del1_src(struct ifmcaddr6 *pmc, int sfmode,
>   			psf->sf_next = pmc->mca_tomb;
>   			pmc->mca_tomb = psf;
>   			rv = 1;
> -		} else
> +		} else {
>   			kfree(psf);
> +		}
>   	}
>   	return rv;
>   }
> @@ -2143,8 +2148,9 @@ static int ip6_mc_del_src(struct inet6_dev *idev, const struct in6_addr *pmca,
>   		for (psf = pmc->mca_sources; psf; psf = psf->sf_next)
>   			psf->sf_crcount = 0;
>   		mld_ifc_event(pmc->idev);
> -	} else if (sf_setstate(pmc) || changerec)
> +	} else if (sf_setstate(pmc) || changerec) {
>   		mld_ifc_event(pmc->idev);
> +	}
>   	spin_unlock_bh(&pmc->mca_lock);
>   	read_unlock_bh(&idev->lock);
>   	return err;
> @@ -2170,9 +2176,9 @@ static int ip6_mc_add1_src(struct ifmcaddr6 *pmc, int sfmode,
>   			return -ENOBUFS;
>   
>   		psf->sf_addr = *psfsrc;
> -		if (psf_prev) {
> +		if (psf_prev)
>   			psf_prev->sf_next = psf;
> -		} else
> +		else
>   			pmc->mca_sources = psf;
>   	}
>   	psf->sf_count[sfmode]++;
> @@ -2189,8 +2195,9 @@ static void sf_markstate(struct ifmcaddr6 *pmc)
>   			psf->sf_oldin = mca_xcount ==
>   				psf->sf_count[MCAST_EXCLUDE] &&
>   				!psf->sf_count[MCAST_INCLUDE];
> -		} else
> +		} else {
>   			psf->sf_oldin = psf->sf_count[MCAST_INCLUDE] != 0;
> +		}
>   }
>   
>   static int sf_setstate(struct ifmcaddr6 *pmc)
> @@ -2311,8 +2318,9 @@ static int ip6_mc_add_src(struct inet6_dev *idev, const struct in6_addr *pmca,
>   		for (psf = pmc->mca_sources; psf; psf = psf->sf_next)
>   			psf->sf_crcount = 0;
>   		mld_ifc_event(idev);
> -	} else if (sf_setstate(pmc))
> +	} else if (sf_setstate(pmc)) {
>   		mld_ifc_event(idev);
> +	}
>   	spin_unlock_bh(&pmc->mca_lock);
>   	read_unlock_bh(&idev->lock);
>   	return err;
> diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
> index d0232b2..a38d730 100644
> --- a/net/ipv6/ndisc.c
> +++ b/net/ipv6/ndisc.c
> @@ -303,9 +303,8 @@ static int ndisc_constructor(struct neighbour *neigh)
>   	bool is_multicast = ipv6_addr_is_multicast(addr);
>   
>   	in6_dev = in6_dev_get(dev);
> -	if (in6_dev == NULL) {
> +	if (in6_dev == NULL)
>   		return -EINVAL;
> -	}
>   
>   	parms = in6_dev->nd_parms;
>   	__neigh_parms_put(neigh->parms);
> @@ -604,9 +603,8 @@ void ndisc_send_rs(struct net_device *dev, const struct in6_addr *saddr,
>   		struct inet6_ifaddr *ifp = ipv6_get_ifaddr(dev_net(dev), saddr,
>   							   dev, 1);
>   		if (ifp) {
> -			if (ifp->flags & IFA_F_OPTIMISTIC)  {
> +			if (ifp->flags & IFA_F_OPTIMISTIC)
>   				send_sllao = 0;
> -			}
>   			in6_ifa_put(ifp);
>   		} else {
>   			send_sllao = 0;
> @@ -805,8 +803,9 @@ static void ndisc_recv_ns(struct sk_buff *skb)
>   					pneigh_enqueue(&nd_tbl, idev->nd_parms, n);
>   				goto out;
>   			}
> -		} else
> +		} else {
>   			goto out;
> +		}
>   	}
>   
>   	if (is_router < 0)
> @@ -865,18 +864,15 @@ static void ndisc_recv_na(struct sk_buff *skb)
>   		ND_PRINTK(2, warn, "NA: packet too short\n");
>   		return;
>   	}
> -
>   	if (ipv6_addr_is_multicast(&msg->target)) {
>   		ND_PRINTK(2, warn, "NA: target address is multicast\n");
>   		return;
>   	}
> -
>   	if (ipv6_addr_is_multicast(daddr) &&
>   	    msg->icmph.icmp6_solicited) {
>   		ND_PRINTK(2, warn, "NA: solicited NA is multicasted\n");
>   		return;
>   	}
> -
>   	if (!ndisc_parse_options(msg->opt, ndoptlen, &ndopts)) {
>   		ND_PRINTK(2, warn, "NS: invalid ND option\n");
>   		return;
> @@ -1026,9 +1022,8 @@ static void ndisc_ra_useropt(struct sk_buff *ra, struct nd_opt_hdr *opt)
>   	}
>   
>   	nlh = nlmsg_put(skb, 0, 0, RTM_NEWNDUSEROPT, base_size, 0);
> -	if (nlh == NULL) {
> +	if (nlh == NULL)
>   		goto nla_put_failure;
> -	}
>   
>   	ndmsg = nlmsg_data(nlh);
>   	ndmsg->nduseropt_family = AF_INET6;
> @@ -1376,9 +1371,8 @@ skip_routeinfo:
>   		}
>   	}
>   
> -	if (ndopts.nd_opts_tgt_lladdr || ndopts.nd_opts_rh) {
> +	if (ndopts.nd_opts_tgt_lladdr || ndopts.nd_opts_rh)
>   		ND_PRINTK(2, warn, "RA: invalid RA options\n");
> -	}
>   out:
>   	ip6_rt_put(rt);
>   	if (neigh)
> diff --git a/net/ipv6/ping.c b/net/ipv6/ping.c
> index 5b7a1ed..b1274f4 100644
> --- a/net/ipv6/ping.c
> +++ b/net/ipv6/ping.c
> @@ -103,13 +103,13 @@ int ping_v6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
>   	if (msg->msg_name) {
>   		DECLARE_SOCKADDR(struct sockaddr_in6 *, u, msg->msg_name);
>   		if (msg->msg_namelen < sizeof(struct sockaddr_in6) ||
> -		    u->sin6_family != AF_INET6) {
> +		    u->sin6_family != AF_INET6)
>   			return -EINVAL;
> -		}
> +
>   		if (sk->sk_bound_dev_if &&
> -		    sk->sk_bound_dev_if != u->sin6_scope_id) {
> +		    sk->sk_bound_dev_if != u->sin6_scope_id)
>   			return -EINVAL;
> -		}
> +
>   		daddr = &(u->sin6_addr);
>   		iif = u->sin6_scope_id;
>   	} else {
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index f74b041..0b924e3 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -708,9 +708,8 @@ int rt6_route_rcv(struct net_device *dev, u8 *opt, int len,
>   	unsigned long lifetime;
>   	struct rt6_info *rt;
>   
> -	if (len < sizeof(struct route_info)) {
> +	if (len < sizeof(struct route_info))
>   		return -EINVAL;
> -	}
>   
>   	/* Sanity check for prefix_len and length */
>   	if (rinfo->length > 3) {
> @@ -718,13 +717,11 @@ int rt6_route_rcv(struct net_device *dev, u8 *opt, int len,
>   	} else if (rinfo->prefix_len > 128) {
>   		return -EINVAL;
>   	} else if (rinfo->prefix_len > 64) {
> -		if (rinfo->length < 2) {
> +		if (rinfo->length < 2)
>   			return -EINVAL;
> -		}
>   	} else if (rinfo->prefix_len > 0) {
> -		if (rinfo->length < 1) {
> +		if (rinfo->length < 1)
>   			return -EINVAL;
> -		}
>   	}
>   
>   	pref = rinfo->route_pref;
> @@ -733,9 +730,9 @@ int rt6_route_rcv(struct net_device *dev, u8 *opt, int len,
>   
>   	lifetime = addrconf_timeout_fixup(ntohl(rinfo->lifetime), HZ);
>   
> -	if (rinfo->length == 3)
> +	if (rinfo->length == 3) {
>   		prefix = (struct in6_addr *)rinfo->prefix;
> -	else {
> +	} else {
>   		/* this function is safe */
>   		ipv6_addr_prefix(&prefix_buf,
>   				 (struct in6_addr *)rinfo->prefix,
> @@ -2578,13 +2575,13 @@ static int rt6_fill_node(struct net *net,
>   			rtm->rtm_type = RTN_UNREACHABLE;
>   			break;
>   		}
> -	}
> -	else if (rt->rt6i_flags & RTF_LOCAL)
> +	} else if (rt->rt6i_flags & RTF_LOCAL) {
>   		rtm->rtm_type = RTN_LOCAL;
> -	else if (rt->dst.dev && (rt->dst.dev->flags & IFF_LOOPBACK))
> +	} else if (rt->dst.dev && (rt->dst.dev->flags & IFF_LOOPBACK)) {
>   		rtm->rtm_type = RTN_LOCAL;
> -	else
> +	} else {
>   		rtm->rtm_type = RTN_UNICAST;
> +	}
>   	rtm->rtm_flags = 0;
>   	rtm->rtm_scope = RT_SCOPE_UNIVERSE;
>   	rtm->rtm_protocol = rt->rt6i_protocol;
> @@ -2682,9 +2679,9 @@ int rt6_dump_route(struct rt6_info *rt, void *p_arg)
>   	if (nlmsg_len(arg->cb->nlh) >= sizeof(struct rtmsg)) {
>   		struct rtmsg *rtm = nlmsg_data(arg->cb->nlh);
>   		prefix = (rtm->rtm_flags & RTM_F_PREFIX) != 0;
> -	} else
> +	} else {
>   		prefix = 0;
> -
> +	}
>   	return rt6_fill_node(arg->net,
>   		     arg->skb, rt, NULL, NULL, 0, RTM_NEWROUTE,
>   		     NETLINK_CB(arg->cb->skb).portid, arg->cb->nlh->nlmsg_seq,
> diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
> index 29964c3..2790300 100644
> --- a/net/ipv6/tcp_ipv6.c
> +++ b/net/ipv6/tcp_ipv6.c
> @@ -454,16 +454,18 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
>   			sk->sk_error_report(sk);		/* Wake people up to see the error (see connect in sock.c) */
>   
>   			tcp_done(sk);
> -		} else
> +		} else {
>   			sk->sk_err_soft = err;
> +		}
>   		goto out;
>   	}
>   
>   	if (!sock_owned_by_user(sk) && np->recverr) {
>   		sk->sk_err = err;
>   		sk->sk_error_report(sk);
> -	} else
> +	} else {
>   		sk->sk_err_soft = err;
> +	}
>   
>   out:
>   	bh_unlock_sock(sk);
> @@ -1323,9 +1325,9 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb)
>   				__kfree_skb(opt_skb);
>   			return 0;
>   		}
> -	} else
> +	} else {
>   		sock_rps_save_rxhash(sk, skb);
> -
> +	}
>   	if (tcp_rcv_state_process(sk, skb, tcp_hdr(skb), skb->len))
>   		goto reset;
>   	if (opt_skb)
> diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
> index e06d460..d59c723 100644
> --- a/net/ipv6/udp.c
> +++ b/net/ipv6/udp.c
> @@ -424,10 +424,10 @@ try_again:
>   			goto csum_copy_err;
>   	}
>   
> -	if (skb_csum_unnecessary(skb))
> +	if (skb_csum_unnecessary(skb)) {
>   		err = skb_copy_datagram_iovec(skb, sizeof(struct udphdr),
>   					      msg->msg_iov, copied);
> -	else {
> +	} else {
>   		err = skb_copy_and_csum_datagram_iovec(skb, sizeof(struct udphdr), msg->msg_iov);
>   		if (err == -EINVAL)
>   			goto csum_copy_err;
> @@ -488,7 +488,6 @@ try_again:
>   		if (np->rxopt.all)
>   			ip6_datagram_recv_specific_ctl(sk, msg, skb);
>   	}
> -
>   	err = copied;
>   	if (flags & MSG_TRUNC)
>   		err = ulen;
> @@ -819,11 +818,10 @@ start_lookup:
>   		goto start_lookup;
>   	}
>   
> -	if (count) {
> +	if (count)
>   		flush_stack(stack, count, skb, count - 1);
> -	} else {
> +	else
>   		kfree_skb(skb);
> -	}
>   	return 0;
>   }
>   
> @@ -1061,9 +1059,10 @@ send:
>   					    UDP_MIB_SNDBUFERRORS, is_udplite);
>   			err = 0;
>   		}
> -	} else
> +	} else {
>   		UDP6_INC_STATS_USER(sock_net(sk),
>   				    UDP_MIB_OUTDATAGRAMS, is_udplite);
> +	}
>   out:
>   	up->len = 0;
>   	up->pending = 0;
> @@ -1119,9 +1118,9 @@ int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk,
>   		if (sk->sk_state != TCP_ESTABLISHED)
>   			return -EDESTADDRREQ;
>   		daddr = &sk->sk_v6_daddr;
> -	} else
> +	} else {
>   		daddr = NULL;
> -
> +	}
>   	if (daddr) {
>   		if (ipv6_addr_v4mapped(daddr)) {
>   			struct sockaddr_in sin;
> @@ -1453,7 +1452,8 @@ int __net_init udp6_proc_init(struct net *net)
>   	return udp_proc_register(net, &udp6_seq_afinfo);
>   }
>   
> -void udp6_proc_exit(struct net *net) {
> +void udp6_proc_exit(struct net *net)
> +{
>   	udp_proc_unregister(net, &udp6_seq_afinfo);
>   }
>   #endif /* CONFIG_PROC_FS */
> diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c
> index ca3f29b..f9f745d 100644
> --- a/net/ipv6/xfrm6_output.c
> +++ b/net/ipv6/xfrm6_output.c
> @@ -159,9 +159,9 @@ static int __xfrm6_output(struct sk_buff *skb)
>   
>   	if (x->props.mode == XFRM_MODE_TUNNEL &&
>   	    ((skb->len > mtu && !skb_is_gso(skb)) ||
> -		dst_allfrag(skb_dst(skb)))) {
> +		dst_allfrag(skb_dst(skb))))
>   			return ip6_fragment(skb, x->outer_mode->afinfo->output_finish);
> -	}
> +
>   	return x->outer_mode->afinfo->output_finish(skb);
>   }
>   
> diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c
> index 5743044..2965098 100644
> --- a/net/ipv6/xfrm6_tunnel.c
> +++ b/net/ipv6/xfrm6_tunnel.c
> @@ -180,8 +180,9 @@ __be32 xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr)
>   	if (x6spi) {
>   		atomic_inc(&x6spi->refcnt);
>   		spi = x6spi->spi;
> -	} else
> +	} else {
>   		spi = __xfrm6_tunnel_alloc_spi(net, saddr);
> +	}
>   	spin_unlock_bh(&xfrm6_tunnel_spi_lock);
>   
>   	return htonl(spi);
> 

-- 
吉藤英明 <hideaki.yoshifuji@miraclelinux.com>
ミラクル・リナックス株式会社 技術本部 サポート部

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

* Re: [PATCH net-next 1/4] ipv6: coding style - no assignment in if statements
  2014-09-02 19:16 ` [PATCH net-next 1/4] ipv6: coding style - no assignment in if statements Ian Morris
@ 2014-09-03  1:44   ` YOSHIFUJI Hideaki
  0 siblings, 0 replies; 10+ messages in thread
From: YOSHIFUJI Hideaki @ 2014-09-03  1:44 UTC (permalink / raw)
  To: Ian Morris, netdev; +Cc: hideaki.yoshifuji, YOSHIFUJI Hideaki

Hi,

Ian Morris wrote:
> This patch makes no changes to the logic of the ipv6 stack however
> it addresses some coding style issues by removing assignments made
> in if statements.
> 
> No change in the object output is detected by the objdiff script.
> 
> Signed-off-by: Ian Morris <ipm@chirality.org.uk>

> diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
> index b7a3e7b..86fc687 100644
> --- a/net/ipv6/ip6_output.c
> +++ b/net/ipv6/ip6_output.c
> @@ -754,9 +754,8 @@ slow_path:
>   		/*
>   		 *	Allocate buffer.
>   		 */
> -
> -		if ((frag = alloc_skb(len + hlen + sizeof(struct frag_hdr) +
> -				      hroom + troom, GFP_ATOMIC)) == NULL) {
> +		frag = alloc_skb(len + hlen + sizeof(struct frag_hdr) + hroom + troom, GFP_ATOMIC);
> +		if (frag == NULL) {

This line is too long.
Otherwise, it seems okay.

-- 
Hideaki Yoshifuji <hideaki.yoshifuji@miraclelinux.com>
Technical Division, MIRACLE LINUX CORPORATION

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

* Re: [PATCH net-next 3/4] ipv6: coding style - convert printk
  2014-09-02 19:16 ` [PATCH net-next 3/4] ipv6: coding style - convert printk Ian Morris
@ 2014-09-03  1:44   ` YOSHIFUJI Hideaki
  0 siblings, 0 replies; 10+ messages in thread
From: YOSHIFUJI Hideaki @ 2014-09-03  1:44 UTC (permalink / raw)
  To: Ian Morris, netdev; +Cc: hideaki.yoshifuji

Hello

Ian Morris wrote:
> No change in the object output is detected by the objdiff script.
> 
> Signed-off-by: Ian Morris <ipm@chirality.org.uk>

Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>

-- 
Hideaki Yoshifuji <hideaki.yoshifuji@miraclelinux.com>
Technical Division, MIRACLE LINUX CORPORATION

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

* RE: [PATCH net-next 4/4] ipv6: coding style - cleanse bracing
  2014-09-03  1:31   ` YOSHIFUJI Hideaki/吉藤英明
@ 2014-09-03  7:52     ` Yuval Mintz
  0 siblings, 0 replies; 10+ messages in thread
From: Yuval Mintz @ 2014-09-03  7:52 UTC (permalink / raw)
  To: YOSHIFUJI Hideaki/吉藤英明, Ian Morris, netdev
  Cc: YOSHIFUJI Hideaki

> Hi,
>
> Ian Morris wrote:
> > Tidy up braces in a few places (mainly if statements):
> > * remove unnecessary braces
> > * add braces for single line statements where part of an "else" where
> > the other branch has braces
>
> Hmm, I am not for this change.
>
> If "if" (or "else") statement occupies multiple lines, I want to see braces even if it
> contains a single statement.
> On the other hand, especiallly if the statement occupiles only one line (and the
> logic do not require those braces), no braces.
>
> e.g. 1
>     if (cond)
>             statement();
>     else {
>             statement2(argument,
>                        argument2);
>     }

I was under the impression the coding style require matching curly braces on all
if and else clauses, e.g., in the previous example I would have expected the `if' to
have curly braces since its else block has them, regardless of whether its
statement-block has more than a single line.

> e.g. 2
>     if (cond) {
>             if (cond2)
>                     statement();
>     } else
>             statement2(argument, argument2);
>
> e.g. 3
>     if (cond) {
>             /* comment */
>             statement();
>     }

________________________________

This message and any attached documents contain information from QLogic Corporation or its wholly-owned subsidiaries that may be confidential. If you are not the intended recipient, you may not read, copy, distribute, or use this information. If you have received this transmission in error, please notify the sender immediately by reply e-mail and then delete this message.

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

end of thread, other threads:[~2014-09-03  7:53 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-02 19:16 [PATCH net-next 0/4] ipv6: coding style improvements Ian Morris
2014-09-02 19:16 ` [PATCH net-next 1/4] ipv6: coding style - no assignment in if statements Ian Morris
2014-09-03  1:44   ` YOSHIFUJI Hideaki
2014-09-02 19:16 ` [PATCH net-next 2/4] ipv6: coding style - min to min_t conversion Ian Morris
2014-09-03  1:29   ` YOSHIFUJI Hideaki
2014-09-02 19:16 ` [PATCH net-next 3/4] ipv6: coding style - convert printk Ian Morris
2014-09-03  1:44   ` YOSHIFUJI Hideaki
2014-09-02 19:16 ` [PATCH net-next 4/4] ipv6: coding style - cleanse bracing Ian Morris
2014-09-03  1:31   ` YOSHIFUJI Hideaki/吉藤英明
2014-09-03  7:52     ` Yuval Mintz

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.