diff options
author | Panagiotis Issaris <takis@issaris.org> | 2006-07-21 17:51:30 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-07-21 17:51:30 -0400 |
commit | 0da974f4f303a6842516b764507e3c0a03f41e5a (patch) | |
tree | 8872aec792f02040269c6769dd1009b20f71d186 /net/rxrpc | |
parent | a0ee7c70b22f78593957f99faa06acb4747b8bc0 (diff) |
[NET]: Conversions from kmalloc+memset to k(z|c)alloc.
Signed-off-by: Panagiotis Issaris <takis@issaris.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/rxrpc')
-rw-r--r-- | net/rxrpc/connection.c | 6 | ||||
-rw-r--r-- | net/rxrpc/peer.c | 3 | ||||
-rw-r--r-- | net/rxrpc/transport.c | 6 |
3 files changed, 5 insertions, 10 deletions
diff --git a/net/rxrpc/connection.c b/net/rxrpc/connection.c index 573b572f8f91..93d2c55ad2d5 100644 --- a/net/rxrpc/connection.c +++ b/net/rxrpc/connection.c | |||
@@ -58,13 +58,12 @@ static inline int __rxrpc_create_connection(struct rxrpc_peer *peer, | |||
58 | _enter("%p",peer); | 58 | _enter("%p",peer); |
59 | 59 | ||
60 | /* allocate and initialise a connection record */ | 60 | /* allocate and initialise a connection record */ |
61 | conn = kmalloc(sizeof(struct rxrpc_connection), GFP_KERNEL); | 61 | conn = kzalloc(sizeof(struct rxrpc_connection), GFP_KERNEL); |
62 | if (!conn) { | 62 | if (!conn) { |
63 | _leave(" = -ENOMEM"); | 63 | _leave(" = -ENOMEM"); |
64 | return -ENOMEM; | 64 | return -ENOMEM; |
65 | } | 65 | } |
66 | 66 | ||
67 | memset(conn, 0, sizeof(struct rxrpc_connection)); | ||
68 | atomic_set(&conn->usage, 1); | 67 | atomic_set(&conn->usage, 1); |
69 | 68 | ||
70 | INIT_LIST_HEAD(&conn->link); | 69 | INIT_LIST_HEAD(&conn->link); |
@@ -535,13 +534,12 @@ int rxrpc_conn_newmsg(struct rxrpc_connection *conn, | |||
535 | return -EINVAL; | 534 | return -EINVAL; |
536 | } | 535 | } |
537 | 536 | ||
538 | msg = kmalloc(sizeof(struct rxrpc_message), alloc_flags); | 537 | msg = kzalloc(sizeof(struct rxrpc_message), alloc_flags); |
539 | if (!msg) { | 538 | if (!msg) { |
540 | _leave(" = -ENOMEM"); | 539 | _leave(" = -ENOMEM"); |
541 | return -ENOMEM; | 540 | return -ENOMEM; |
542 | } | 541 | } |
543 | 542 | ||
544 | memset(msg, 0, sizeof(*msg)); | ||
545 | atomic_set(&msg->usage, 1); | 543 | atomic_set(&msg->usage, 1); |
546 | 544 | ||
547 | INIT_LIST_HEAD(&msg->link); | 545 | INIT_LIST_HEAD(&msg->link); |
diff --git a/net/rxrpc/peer.c b/net/rxrpc/peer.c index ed38f5b17c1b..8a275157a3bb 100644 --- a/net/rxrpc/peer.c +++ b/net/rxrpc/peer.c | |||
@@ -58,13 +58,12 @@ static int __rxrpc_create_peer(struct rxrpc_transport *trans, __be32 addr, | |||
58 | _enter("%p,%08x", trans, ntohl(addr)); | 58 | _enter("%p,%08x", trans, ntohl(addr)); |
59 | 59 | ||
60 | /* allocate and initialise a peer record */ | 60 | /* allocate and initialise a peer record */ |
61 | peer = kmalloc(sizeof(struct rxrpc_peer), GFP_KERNEL); | 61 | peer = kzalloc(sizeof(struct rxrpc_peer), GFP_KERNEL); |
62 | if (!peer) { | 62 | if (!peer) { |
63 | _leave(" = -ENOMEM"); | 63 | _leave(" = -ENOMEM"); |
64 | return -ENOMEM; | 64 | return -ENOMEM; |
65 | } | 65 | } |
66 | 66 | ||
67 | memset(peer, 0, sizeof(struct rxrpc_peer)); | ||
68 | atomic_set(&peer->usage, 1); | 67 | atomic_set(&peer->usage, 1); |
69 | 68 | ||
70 | INIT_LIST_HEAD(&peer->link); | 69 | INIT_LIST_HEAD(&peer->link); |
diff --git a/net/rxrpc/transport.c b/net/rxrpc/transport.c index dbe6105e83a5..465efc86fccf 100644 --- a/net/rxrpc/transport.c +++ b/net/rxrpc/transport.c | |||
@@ -68,11 +68,10 @@ int rxrpc_create_transport(unsigned short port, | |||
68 | 68 | ||
69 | _enter("%hu", port); | 69 | _enter("%hu", port); |
70 | 70 | ||
71 | trans = kmalloc(sizeof(struct rxrpc_transport), GFP_KERNEL); | 71 | trans = kzalloc(sizeof(struct rxrpc_transport), GFP_KERNEL); |
72 | if (!trans) | 72 | if (!trans) |
73 | return -ENOMEM; | 73 | return -ENOMEM; |
74 | 74 | ||
75 | memset(trans, 0, sizeof(struct rxrpc_transport)); | ||
76 | atomic_set(&trans->usage, 1); | 75 | atomic_set(&trans->usage, 1); |
77 | INIT_LIST_HEAD(&trans->services); | 76 | INIT_LIST_HEAD(&trans->services); |
78 | INIT_LIST_HEAD(&trans->link); | 77 | INIT_LIST_HEAD(&trans->link); |
@@ -312,13 +311,12 @@ static int rxrpc_incoming_msg(struct rxrpc_transport *trans, | |||
312 | 311 | ||
313 | _enter(""); | 312 | _enter(""); |
314 | 313 | ||
315 | msg = kmalloc(sizeof(struct rxrpc_message), GFP_KERNEL); | 314 | msg = kzalloc(sizeof(struct rxrpc_message), GFP_KERNEL); |
316 | if (!msg) { | 315 | if (!msg) { |
317 | _leave(" = -ENOMEM"); | 316 | _leave(" = -ENOMEM"); |
318 | return -ENOMEM; | 317 | return -ENOMEM; |
319 | } | 318 | } |
320 | 319 | ||
321 | memset(msg, 0, sizeof(*msg)); | ||
322 | atomic_set(&msg->usage, 1); | 320 | atomic_set(&msg->usage, 1); |
323 | list_add_tail(&msg->link,msgq); | 321 | list_add_tail(&msg->link,msgq); |
324 | 322 | ||