]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
[NET]: Forget the zero_it argument of sk_alloc()
authorPavel Emelyanov <xemul@openvz.org>
Thu, 1 Nov 2007 07:39:31 +0000 (00:39 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 1 Nov 2007 07:39:31 +0000 (00:39 -0700)
Finally, the zero_it argument can be completely removed from
the callers and from the function prototype.

Besides, fix the checkpatch.pl warnings about using the
assignments inside if-s.

This patch is rather big, and it is a part of the previous one.
I splitted it wishing to make the patches more readable. Hope
this particular split helped.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
33 files changed:
drivers/net/pppoe.c
drivers/net/pppol2tp.c
include/net/sock.h
net/appletalk/ddp.c
net/atm/common.c
net/ax25/af_ax25.c
net/bluetooth/bnep/sock.c
net/bluetooth/cmtp/sock.c
net/bluetooth/hci_sock.c
net/bluetooth/hidp/sock.c
net/bluetooth/l2cap.c
net/bluetooth/rfcomm/sock.c
net/bluetooth/sco.c
net/core/sock.c
net/decnet/af_decnet.c
net/econet/af_econet.c
net/ipv4/af_inet.c
net/ipv6/af_inet6.c
net/ipx/af_ipx.c
net/irda/af_irda.c
net/iucv/af_iucv.c
net/key/af_key.c
net/llc/llc_conn.c
net/netlink/af_netlink.c
net/netrom/af_netrom.c
net/packet/af_packet.c
net/rose/af_rose.c
net/rxrpc/af_rxrpc.c
net/sctp/ipv6.c
net/sctp/protocol.c
net/tipc/socket.c
net/unix/af_unix.c
net/x25/af_x25.c

index 8936ed3469cf0744a68ace9e205ea6a804ce3b85..a005d8f4c38e545e80237abbcb83cdba34e161e3 100644 (file)
@@ -491,7 +491,7 @@ static int pppoe_create(struct net *net, struct socket *sock)
        int error = -ENOMEM;
        struct sock *sk;
 
-       sk = sk_alloc(net, PF_PPPOX, GFP_KERNEL, &pppoe_sk_proto, 1);
+       sk = sk_alloc(net, PF_PPPOX, GFP_KERNEL, &pppoe_sk_proto);
        if (!sk)
                goto out;
 
index 921d4ef6d14b66d1b66c0c4b606a571cbec82020..f8904fd92369be8ee2ded044f8c55856f31960ac 100644 (file)
@@ -1416,7 +1416,7 @@ static int pppol2tp_create(struct net *net, struct socket *sock)
        int error = -ENOMEM;
        struct sock *sk;
 
-       sk = sk_alloc(net, PF_PPPOX, GFP_KERNEL, &pppol2tp_sk_proto, 1);
+       sk = sk_alloc(net, PF_PPPOX, GFP_KERNEL, &pppol2tp_sk_proto);
        if (!sk)
                goto out;
 
index ecad7b4e2a6313f07a329316d249fcbf62e0bdfc..20de3fa7ae40001bbe7771bb32915b8604f686f7 100644 (file)
@@ -779,7 +779,7 @@ extern void FASTCALL(release_sock(struct sock *sk));
 
 extern struct sock             *sk_alloc(struct net *net, int family,
                                          gfp_t priority,
-                                         struct proto *prot, int zero_it);
+                                         struct proto *prot);
 extern void                    sk_free(struct sock *sk);
 extern struct sock             *sk_clone(const struct sock *sk,
                                          const gfp_t priority);
index 7c0b5151d5265408614fda8c25e489aff50c5b41..e0d37d6dc1f81e6ec7455fe5d1f0c5acabc0ccd8 100644 (file)
@@ -1044,7 +1044,7 @@ static int atalk_create(struct net *net, struct socket *sock, int protocol)
        if (sock->type != SOCK_RAW && sock->type != SOCK_DGRAM)
                goto out;
        rc = -ENOMEM;
-       sk = sk_alloc(net, PF_APPLETALK, GFP_KERNEL, &ddp_proto, 1);
+       sk = sk_alloc(net, PF_APPLETALK, GFP_KERNEL, &ddp_proto);
        if (!sk)
                goto out;
        rc = 0;
index e166d9e0ffd949f0fe9246a615d7f0a7fbb54b9d..eba09a04f6bf446f7922ca6b2a36e4b976993143 100644 (file)
@@ -133,7 +133,7 @@ int vcc_create(struct net *net, struct socket *sock, int protocol, int family)
        sock->sk = NULL;
        if (sock->type == SOCK_STREAM)
                return -EINVAL;
-       sk = sk_alloc(net, family, GFP_KERNEL, &vcc_proto, 1);
+       sk = sk_alloc(net, family, GFP_KERNEL, &vcc_proto);
        if (!sk)
                return -ENOMEM;
        sock_init_data(sock, sk);
index 993e5c75e90908c22c079f02ae5646f250fbfa8f..8378afd54b3014139eadf74f1414252a088e2966 100644 (file)
@@ -836,7 +836,8 @@ static int ax25_create(struct net *net, struct socket *sock, int protocol)
                return -ESOCKTNOSUPPORT;
        }
 
-       if ((sk = sk_alloc(net, PF_AX25, GFP_ATOMIC, &ax25_proto, 1)) == NULL)
+       sk = sk_alloc(net, PF_AX25, GFP_ATOMIC, &ax25_proto);
+       if (sk == NULL)
                return -ENOMEM;
 
        ax25 = sk->sk_protinfo = ax25_create_cb();
@@ -861,7 +862,8 @@ struct sock *ax25_make_new(struct sock *osk, struct ax25_dev *ax25_dev)
        struct sock *sk;
        ax25_cb *ax25, *oax25;
 
-       if ((sk = sk_alloc(osk->sk_net, PF_AX25, GFP_ATOMIC, osk->sk_prot, 1)) == NULL)
+       sk = sk_alloc(osk->sk_net, PF_AX25, GFP_ATOMIC, osk->sk_prot);
+       if (sk == NULL)
                return NULL;
 
        if ((ax25 = ax25_create_cb()) == NULL) {
index f718965f296c7c3cdd2b46453ffff644fd62fa53..9ebd3c64474d916480506d20e2db8be6f1b30182 100644 (file)
@@ -213,7 +213,7 @@ static int bnep_sock_create(struct net *net, struct socket *sock, int protocol)
        if (sock->type != SOCK_RAW)
                return -ESOCKTNOSUPPORT;
 
-       sk = sk_alloc(net, PF_BLUETOOTH, GFP_ATOMIC, &bnep_proto, 1);
+       sk = sk_alloc(net, PF_BLUETOOTH, GFP_ATOMIC, &bnep_proto);
        if (!sk)
                return -ENOMEM;
 
index cf700c20d11eb8915d901914ce3a02e8b546d838..783edab12ce82c024610b9dd3b91b9ee9f21ca3e 100644 (file)
@@ -204,7 +204,7 @@ static int cmtp_sock_create(struct net *net, struct socket *sock, int protocol)
        if (sock->type != SOCK_RAW)
                return -ESOCKTNOSUPPORT;
 
-       sk = sk_alloc(net, PF_BLUETOOTH, GFP_ATOMIC, &cmtp_proto, 1);
+       sk = sk_alloc(net, PF_BLUETOOTH, GFP_ATOMIC, &cmtp_proto);
        if (!sk)
                return -ENOMEM;
 
index 8825102c517c48180960a5821c949f6463ce0480..14991323c273a15793823107e25d79af5403f58e 100644 (file)
@@ -645,7 +645,7 @@ static int hci_sock_create(struct net *net, struct socket *sock, int protocol)
 
        sock->ops = &hci_sock_ops;
 
-       sk = sk_alloc(net, PF_BLUETOOTH, GFP_ATOMIC, &hci_sk_proto, 1);
+       sk = sk_alloc(net, PF_BLUETOOTH, GFP_ATOMIC, &hci_sk_proto);
        if (!sk)
                return -ENOMEM;
 
index 1de2b6fbcac0d442a2d9073e145aa82e3eb9c1d4..3292b956a7c491267d023ae5406561447a639810 100644 (file)
@@ -255,7 +255,7 @@ static int hidp_sock_create(struct net *net, struct socket *sock, int protocol)
        if (sock->type != SOCK_RAW)
                return -ESOCKTNOSUPPORT;
 
-       sk = sk_alloc(net, PF_BLUETOOTH, GFP_ATOMIC, &hidp_proto, 1);
+       sk = sk_alloc(net, PF_BLUETOOTH, GFP_ATOMIC, &hidp_proto);
        if (!sk)
                return -ENOMEM;
 
index 6fbbae78b30452c8ee6e20742d011ebaba4acc11..477e052b17b5d57bdbb820f9b5b98252b13f17b9 100644 (file)
@@ -607,7 +607,7 @@ static struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock, int p
 {
        struct sock *sk;
 
-       sk = sk_alloc(net, PF_BLUETOOTH, prio, &l2cap_proto, 1);
+       sk = sk_alloc(net, PF_BLUETOOTH, prio, &l2cap_proto);
        if (!sk)
                return NULL;
 
index 266b6972667d7713899a22681af5f0a8eef21f73..c46d51035e77fa9e1f4db6e95fadb3f2e17f3e60 100644 (file)
@@ -287,7 +287,7 @@ static struct sock *rfcomm_sock_alloc(struct net *net, struct socket *sock, int
        struct rfcomm_dlc *d;
        struct sock *sk;
 
-       sk = sk_alloc(net, PF_BLUETOOTH, prio, &rfcomm_proto, 1);
+       sk = sk_alloc(net, PF_BLUETOOTH, prio, &rfcomm_proto);
        if (!sk)
                return NULL;
 
index 82d0dfdfa7e268a3dc21d03fb6d3d822b6998c50..93ad1aae3f38dece58f5820002216c18942b6b75 100644 (file)
@@ -421,7 +421,7 @@ static struct sock *sco_sock_alloc(struct net *net, struct socket *sock, int pro
 {
        struct sock *sk;
 
-       sk = sk_alloc(net, PF_BLUETOOTH, prio, &sco_proto, 1);
+       sk = sk_alloc(net, PF_BLUETOOTH, prio, &sco_proto);
        if (!sk)
                return NULL;
 
index 6046fc69428b0db3da2058ce1bde63511c90b7df..12ad2067a988405b2768afa4eb421afd8440a1c8 100644 (file)
@@ -927,7 +927,7 @@ static void sk_prot_free(struct proto *prot, struct sock *sk)
  *     @zero_it: if we should zero the newly allocated sock
  */
 struct sock *sk_alloc(struct net *net, int family, gfp_t priority,
-                     struct proto *prot, int zero_it)
+                     struct proto *prot)
 {
        struct sock *sk;
 
index aabe98d9402f492bac411e111da9a0cc66a011f8..57d5749518380c06cd9dc6863d649e8cfbc230fe 100644 (file)
@@ -474,7 +474,7 @@ static struct proto dn_proto = {
 static struct sock *dn_alloc_sock(struct net *net, struct socket *sock, gfp_t gfp)
 {
        struct dn_scp *scp;
-       struct sock *sk = sk_alloc(net, PF_DECnet, gfp, &dn_proto, 1);
+       struct sock *sk = sk_alloc(net, PF_DECnet, gfp, &dn_proto);
 
        if  (!sk)
                goto out;
index 9cae16b4e0b7cea737c88a763d34a8eb49d079a8..f70df073c58800552cf69a105da1b2c800e40383 100644 (file)
@@ -624,7 +624,7 @@ static int econet_create(struct net *net, struct socket *sock, int protocol)
        sock->state = SS_UNCONNECTED;
 
        err = -ENOBUFS;
-       sk = sk_alloc(net, PF_ECONET, GFP_KERNEL, &econet_proto, 1);
+       sk = sk_alloc(net, PF_ECONET, GFP_KERNEL, &econet_proto);
        if (sk == NULL)
                goto out;
 
index 621b128897d7af80015506b4ae7abb8116ad6d23..d2f22e74b26713b2125d2e6c2a7385eb47840336 100644 (file)
@@ -323,7 +323,7 @@ lookup_protocol:
        BUG_TRAP(answer_prot->slab != NULL);
 
        err = -ENOBUFS;
-       sk = sk_alloc(net, PF_INET, GFP_KERNEL, answer_prot, 1);
+       sk = sk_alloc(net, PF_INET, GFP_KERNEL, answer_prot);
        if (sk == NULL)
                goto out;
 
index 1b1caf3aa1c189d7ce57bf38d4276afa5d4c35c9..ecbd38894fdd1b2f971c1aeb25e36d1b74e961de 100644 (file)
@@ -162,7 +162,7 @@ lookup_protocol:
        BUG_TRAP(answer_prot->slab != NULL);
 
        err = -ENOBUFS;
-       sk = sk_alloc(net, PF_INET6, GFP_KERNEL, answer_prot, 1);
+       sk = sk_alloc(net, PF_INET6, GFP_KERNEL, answer_prot);
        if (sk == NULL)
                goto out;
 
index 29b063d4312052cefd1a9bbdfd02b62d8b212211..a195a66e0cc799192e258533a84c0b3a558b92ce 100644 (file)
@@ -1381,7 +1381,7 @@ static int ipx_create(struct net *net, struct socket *sock, int protocol)
                goto out;
 
        rc = -ENOMEM;
-       sk = sk_alloc(net, PF_IPX, GFP_KERNEL, &ipx_proto, 1);
+       sk = sk_alloc(net, PF_IPX, GFP_KERNEL, &ipx_proto);
        if (!sk)
                goto out;
 #ifdef IPX_REFCNT_DEBUG
index 0328ae2654f43333fc09980368dec290641d24fb..48ce59a6e0265bf6bef19fa79b2e056e85aa9bdd 100644 (file)
@@ -1078,7 +1078,7 @@ static int irda_create(struct net *net, struct socket *sock, int protocol)
        }
 
        /* Allocate networking socket */
-       sk = sk_alloc(net, PF_IRDA, GFP_ATOMIC, &irda_proto, 1);
+       sk = sk_alloc(net, PF_IRDA, GFP_ATOMIC, &irda_proto);
        if (sk == NULL)
                return -ENOMEM;
 
index 43e01c8d382b5ab09f8d1c94f7b2572b3c89902b..aef6645803559c0e0695574a731dad158fa8a091 100644 (file)
@@ -216,7 +216,7 @@ static struct sock *iucv_sock_alloc(struct socket *sock, int proto, gfp_t prio)
 {
        struct sock *sk;
 
-       sk = sk_alloc(&init_net, PF_IUCV, prio, &iucv_proto, 1);
+       sk = sk_alloc(&init_net, PF_IUCV, prio, &iucv_proto);
        if (!sk)
                return NULL;
 
index 266f112c38c2fdee4842f60933f38b866916d1c1..10c89d47f685e492702a595dfc0061269d27801f 100644 (file)
@@ -152,7 +152,7 @@ static int pfkey_create(struct net *net, struct socket *sock, int protocol)
                return -EPROTONOSUPPORT;
 
        err = -ENOMEM;
-       sk = sk_alloc(net, PF_KEY, GFP_KERNEL, &key_proto, 1);
+       sk = sk_alloc(net, PF_KEY, GFP_KERNEL, &key_proto);
        if (sk == NULL)
                goto out;
 
index 8ebc2769dfdabc88c288468002148d5c974fd68f..5c0b484237c81b0b370369f48d9449b796c3d9ac 100644 (file)
@@ -869,7 +869,7 @@ static void llc_sk_init(struct sock* sk)
  */
 struct sock *llc_sk_alloc(struct net *net, int family, gfp_t priority, struct proto *prot)
 {
-       struct sock *sk = sk_alloc(net, family, priority, prot, 1);
+       struct sock *sk = sk_alloc(net, family, priority, prot);
 
        if (!sk)
                goto out;
index 4f994c0fb3f80dcc4542a4e7a17475637601b690..2601712555767b34d49fb694a5adbb12e734a44d 100644 (file)
@@ -396,7 +396,7 @@ static int __netlink_create(struct net *net, struct socket *sock,
 
        sock->ops = &netlink_ops;
 
-       sk = sk_alloc(net, PF_NETLINK, GFP_KERNEL, &netlink_proto, 1);
+       sk = sk_alloc(net, PF_NETLINK, GFP_KERNEL, &netlink_proto);
        if (!sk)
                return -ENOMEM;
 
index 3a4d479ea64e493c342f9fde022f28adbbeb29c1..972250c974f1ceaf053eb92712018d4be781ed78 100644 (file)
@@ -423,7 +423,8 @@ static int nr_create(struct net *net, struct socket *sock, int protocol)
        if (sock->type != SOCK_SEQPACKET || protocol != 0)
                return -ESOCKTNOSUPPORT;
 
-       if ((sk = sk_alloc(net, PF_NETROM, GFP_ATOMIC, &nr_proto, 1)) == NULL)
+       sk = sk_alloc(net, PF_NETROM, GFP_ATOMIC, &nr_proto);
+       if (sk  == NULL)
                return -ENOMEM;
 
        nr = nr_sk(sk);
@@ -465,7 +466,8 @@ static struct sock *nr_make_new(struct sock *osk)
        if (osk->sk_type != SOCK_SEQPACKET)
                return NULL;
 
-       if ((sk = sk_alloc(osk->sk_net, PF_NETROM, GFP_ATOMIC, osk->sk_prot, 1)) == NULL)
+       sk = sk_alloc(osk->sk_net, PF_NETROM, GFP_ATOMIC, osk->sk_prot);
+       if (sk == NULL)
                return NULL;
 
        nr = nr_sk(sk);
index d0936506b731abf62d5fabffe289a44789c52768..4cb2dfba09931225e151bf86f78d7e5ff7060cf9 100644 (file)
@@ -995,7 +995,7 @@ static int packet_create(struct net *net, struct socket *sock, int protocol)
        sock->state = SS_UNCONNECTED;
 
        err = -ENOBUFS;
-       sk = sk_alloc(net, PF_PACKET, GFP_KERNEL, &packet_proto, 1);
+       sk = sk_alloc(net, PF_PACKET, GFP_KERNEL, &packet_proto);
        if (sk == NULL)
                goto out;
 
index 509defe53ee53fb5b49f37c0b2372edfa83cc68b..ed2d65cd80106db4510bb708c8514ce4aa17fea6 100644 (file)
@@ -513,7 +513,8 @@ static int rose_create(struct net *net, struct socket *sock, int protocol)
        if (sock->type != SOCK_SEQPACKET || protocol != 0)
                return -ESOCKTNOSUPPORT;
 
-       if ((sk = sk_alloc(net, PF_ROSE, GFP_ATOMIC, &rose_proto, 1)) == NULL)
+       sk = sk_alloc(net, PF_ROSE, GFP_ATOMIC, &rose_proto);
+       if (sk == NULL)
                return -ENOMEM;
 
        rose = rose_sk(sk);
@@ -551,7 +552,8 @@ static struct sock *rose_make_new(struct sock *osk)
        if (osk->sk_type != SOCK_SEQPACKET)
                return NULL;
 
-       if ((sk = sk_alloc(osk->sk_net, PF_ROSE, GFP_ATOMIC, &rose_proto, 1)) == NULL)
+       sk = sk_alloc(osk->sk_net, PF_ROSE, GFP_ATOMIC, &rose_proto);
+       if (sk == NULL)
                return NULL;
 
        rose = rose_sk(sk);
index c680017f5c8e923f7b59a7d0fc146ed3d4351c8b..d6389450c4bffee0da440bccfbc49857fa258417 100644 (file)
@@ -627,7 +627,7 @@ static int rxrpc_create(struct net *net, struct socket *sock, int protocol)
        sock->ops = &rxrpc_rpc_ops;
        sock->state = SS_UNCONNECTED;
 
-       sk = sk_alloc(net, PF_RXRPC, GFP_KERNEL, &rxrpc_proto, 1);
+       sk = sk_alloc(net, PF_RXRPC, GFP_KERNEL, &rxrpc_proto);
        if (!sk)
                return -ENOMEM;
 
index eb4deaf589148dbf7a8797449f34439779da4a63..7f31ff638bc63fd521bd84ec4ca901451e832fe5 100644 (file)
@@ -631,7 +631,7 @@ static struct sock *sctp_v6_create_accept_sk(struct sock *sk,
        struct ipv6_pinfo *newnp, *np = inet6_sk(sk);
        struct sctp6_sock *newsctp6sk;
 
-       newsk = sk_alloc(sk->sk_net, PF_INET6, GFP_KERNEL, sk->sk_prot, 1);
+       newsk = sk_alloc(sk->sk_net, PF_INET6, GFP_KERNEL, sk->sk_prot);
        if (!newsk)
                goto out;
 
index f5cd96f5fe7421fbee8afcb33e0f558e99877e2a..40c1a47d1b8dc2972abcf481dc42c5d30ed55229 100644 (file)
@@ -552,7 +552,8 @@ static struct sock *sctp_v4_create_accept_sk(struct sock *sk,
 {
        struct inet_sock *inet = inet_sk(sk);
        struct inet_sock *newinet;
-       struct sock *newsk = sk_alloc(sk->sk_net, PF_INET, GFP_KERNEL, sk->sk_prot, 1);
+       struct sock *newsk = sk_alloc(sk->sk_net, PF_INET, GFP_KERNEL,
+                       sk->sk_prot);
 
        if (!newsk)
                goto out;
index e36b4b5a5222320644fd1d7fe35c06bfe982e7f0..6b792265dc06e5b08085095178bd4fba3e427ff7 100644 (file)
@@ -201,7 +201,7 @@ static int tipc_create(struct net *net, struct socket *sock, int protocol)
                return -EPROTOTYPE;
        }
 
-       sk = sk_alloc(net, AF_TIPC, GFP_KERNEL, &tipc_proto, 1);
+       sk = sk_alloc(net, AF_TIPC, GFP_KERNEL, &tipc_proto);
        if (!sk) {
                tipc_deleteport(ref);
                return -ENOMEM;
index 9163ec526c2a0e66ed2fdf20f232173f6aed8d90..515e7a692f9bf85e263bf5a8752c22f0384595d0 100644 (file)
@@ -602,7 +602,7 @@ static struct sock * unix_create1(struct net *net, struct socket *sock)
        if (atomic_read(&unix_nr_socks) >= 2*get_max_files())
                goto out;
 
-       sk = sk_alloc(net, PF_UNIX, GFP_KERNEL, &unix_proto, 1);
+       sk = sk_alloc(net, PF_UNIX, GFP_KERNEL, &unix_proto);
        if (!sk)
                goto out;
 
index fc416f9606a9e259e22f2e641c602107e06b9200..92cfe8e3e0b8d24133b6e5e07cafa6d5d27328e2 100644 (file)
@@ -472,7 +472,7 @@ static struct proto x25_proto = {
 static struct sock *x25_alloc_socket(struct net *net)
 {
        struct x25_sock *x25;
-       struct sock *sk = sk_alloc(net, AF_X25, GFP_ATOMIC, &x25_proto, 1);
+       struct sock *sk = sk_alloc(net, AF_X25, GFP_ATOMIC, &x25_proto);
 
        if (!sk)
                goto out;