[PATCH] ipv4: Fixed checkpatch warnings and errors

Subsystems: networking [general], the rest

STALE5212d

3 messages, 3 authors, 2012-05-08 · open the first message on its own page

[PATCH] ipv4: Fixed checkpatch warnings and errors

From: Cristian Chilipirea <hidden>
Date: 2012-05-08 10:58:37

Fixed warnings and errors in af_inet.c.

Signed-off-by: Cristian Chilipirea <redacted>
---
 net/ipv4/af_inet.c |   55 +++++++++++++++++++++++++++++----------------------
 1 files changed, 31 insertions(+), 24 deletions(-)
 mode change 100644 => 100755 net/ipv4/af_inet.c
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
old mode 100644
new mode 100644
index 10e3751..19399f9
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -28,7 +28,7 @@
  *					some RPC stuff seems happier.
  *		Niibe Yutaka	:	4.4BSD style write async I/O
  *		Alan Cox,
- *		Tony Gale 	:	Fixed reuse semantics.
+ *		Tony Gale	:	Fixed reuse semantics.
  *		Alan Cox	:	bind() shouldn't abort existing but dead
  *					sockets. Stops FTP netin:.. I hope.
  *		Alan Cox	:	bind() works correctly for RAW sockets.
@@ -90,7 +90,7 @@
 #include <linux/random.h>
 #include <linux/slab.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <linux/inet.h>
 #include <linux/igmp.h>
@@ -541,7 +541,7 @@ out:
 }
 EXPORT_SYMBOL(inet_bind);
 
-int inet_dgram_connect(struct socket *sock, struct sockaddr * uaddr,
+int inet_dgram_connect(struct socket *sock, struct sockaddr *uaddr,
 		       int addr_len, int flags)
 {
 	struct sock *sk = sock->sk;
@@ -895,7 +895,8 @@ int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
 EXPORT_SYMBOL(inet_ioctl);
 
 #ifdef CONFIG_COMPAT
-static int inet_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
+static int inet_compat_ioctl(struct socket *sock, unsigned int cmd,
+		unsigned long arg)
 {
 	struct sock *sk = sock->sk;
 	int err = -ENOIOCTLCMD;
@@ -1001,8 +1002,7 @@ static const struct net_proto_family inet_family_ops = {
 /* Upon startup we insert all the elements in inetsw_array[] into
  * the linked list inetsw.
  */
-static struct inet_protosw inetsw_array[] =
-{
+static struct inet_protosw inetsw_array[] = {
 	{
 		.type =       SOCK_STREAM,
 		.protocol =   IPPROTO_TCP,
@@ -1020,25 +1020,25 @@ static struct inet_protosw inetsw_array[] =
 		.ops =        &inet_dgram_ops,
 		.no_check =   UDP_CSUM_DEFAULT,
 		.flags =      INET_PROTOSW_PERMANENT,
-       },
+	},
 
-       {
+	{
 		.type =       SOCK_DGRAM,
 		.protocol =   IPPROTO_ICMP,
 		.prot =       &ping_prot,
 		.ops =        &inet_dgram_ops,
 		.no_check =   UDP_CSUM_DEFAULT,
 		.flags =      INET_PROTOSW_REUSE,
-       },
-
-       {
-	       .type =       SOCK_RAW,
-	       .protocol =   IPPROTO_IP,	/* wild card */
-	       .prot =       &raw_prot,
-	       .ops =        &inet_sockraw_ops,
-	       .no_check =   UDP_CSUM_DEFAULT,
-	       .flags =      INET_PROTOSW_REUSE,
-       }
+	},
+
+	{
+		.type =       SOCK_RAW,
+		.protocol =   IPPROTO_IP,	/* wild card */
+		.prot =       &raw_prot,
+		.ops =        &inet_sockraw_ops,
+		.no_check =   UDP_CSUM_DEFAULT,
+		.flags =      INET_PROTOSW_REUSE,
+	}
 };
 
 #define INETSW_ARRAY_LEN ARRAY_SIZE(inetsw_array)
@@ -1187,7 +1187,8 @@ int inet_sk_rebuild_header(struct sock *sk)
 		daddr = inet_opt->opt.faddr;
 	rcu_read_unlock();
 	fl4 = &inet->cork.fl.u.ip4;
-	rt = ip_route_output_ports(sock_net(sk), fl4, sk, daddr, inet->inet_saddr,
+	rt = ip_route_output_ports(sock_net(sk), fl4, sk, daddr,
+				   inet->inet_saddr,
 				   inet->inet_dport, inet->inet_sport,
 				   sk->sk_protocol, RT_CONN_FLAGS(sk),
 				   sk->sk_bound_dev_if);
@@ -1200,14 +1201,19 @@ int inet_sk_rebuild_header(struct sock *sk)
 		/* Routing failed... */
 		sk->sk_route_caps = 0;
 		/*
-		 * Other protocols have to map its equivalent state to TCP_SYN_SENT.
+		 * Other protocols have to map its equivalent state
+		 * to TCP_SYN_SENT.
 		 * DCCP maps its DCCP_REQUESTING state to TCP_SYN_SENT. -acme
 		 */
 		if (!sysctl_ip_dynaddr ||
 		    sk->sk_state != TCP_SYN_SENT ||
-		    (sk->sk_userlocks & SOCK_BINDADDR_LOCK) ||
-		    (err = inet_sk_reselect_saddr(sk)) != 0)
+		    (sk->sk_userlocks & SOCK_BINDADDR_LOCK)) {
 			sk->sk_err_soft = -err;
+		} else {
+			err = inet_sk_reselect_saddr(sk);
+			if (err != 0)
+				sk->sk_err_soft = -err;
+		}
 	}
 
 	return err;
@@ -1354,7 +1360,8 @@ static struct sk_buff **inet_gro_receive(struct sk_buff **head,
 		goto out_unlock;
 
 	id = ntohl(*(__be32 *)&iph->id);
-	flush = (u16)((ntohl(*(__be32 *)iph) ^ skb_gro_len(skb)) | (id ^ IP_DF));
+	flush = (u16)((ntohl(*(__be32 *)iph) ^ skb_gro_len(skb)) |
+		(id ^ IP_DF));
 	id >>= 16;
 
 	for (p = *head; p; p = p->next) {
@@ -1455,7 +1462,7 @@ unsigned long snmp_fold_field(void __percpu *mib[], int offt)
 }
 EXPORT_SYMBOL_GPL(snmp_fold_field);
 
-#if BITS_PER_LONG==32
+#if BITS_PER_LONG == 32
 
 u64 snmp_fold_field64(void __percpu *mib[], int offt, size_t syncp_offset)
 {
-- 
1.7.5.4

Re: [PATCH] ipv4: Fixed checkpatch warnings and errors

From: Ben Greear <hidden>
Date: 2012-05-08 15:14:34

On 05/08/2012 03:58 AM, Cristian Chilipirea wrote:
Fixed warnings and errors in af_inet.c.
  #ifdef CONFIG_COMPAT
-static int inet_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
+static int inet_compat_ioctl(struct socket *sock, unsigned int cmd,
+		unsigned long arg)
  {
That is so much worse than what was there before.

Lets stop useless checkpatch crap on existing code
unless it's really ugly.

Thanks,
Ben


-- 
Ben Greear [off-list ref]
Candela Technologies Inc  http://www.candelatech.com

Re: [PATCH] ipv4: Fixed checkpatch warnings and errors

From: David Miller <davem@davemloft.net>
Date: 2012-05-08 17:04:21

From: Ben Greear <redacted>
Date: Tue, 08 May 2012 08:13:46 -0700
On 05/08/2012 03:58 AM, Cristian Chilipirea wrote:
quoted
Fixed warnings and errors in af_inet.c.
quoted
  #ifdef CONFIG_COMPAT
-static int inet_compat_ioctl(struct socket *sock, unsigned int cmd,
-unsigned long arg)
+static int inet_compat_ioctl(struct socket *sock, unsigned int cmd,
+		unsigned long arg)
  {
That is so much worse than what was there before.

Lets stop useless checkpatch crap on existing code
unless it's really ugly.
Agreed, this patch is terrible.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help