Commit c91f9d94 authored by Luiz Capitulino's avatar Luiz Capitulino Committed by David S. Miller

[NET]: __sock_create() cleanup

The 'i' variable in net/socket.c::__sock_create() is not necessary.  It's
have been used to store error codes but there is an 'err' variable already.
Signed-off-by: default avatarLuiz Capitulino <lcapitulino@conectiva.com.br>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e1aa5d09
...@@ -1073,7 +1073,6 @@ int sock_wake_async(struct socket *sock, int how, int band) ...@@ -1073,7 +1073,6 @@ int sock_wake_async(struct socket *sock, int how, int band)
static int __sock_create(int family, int type, int protocol, struct socket **res, int kern) static int __sock_create(int family, int type, int protocol, struct socket **res, int kern)
{ {
int i;
int err; int err;
struct socket *sock; struct socket *sock;
...@@ -1118,7 +1117,7 @@ static int __sock_create(int family, int type, int protocol, struct socket **res ...@@ -1118,7 +1117,7 @@ static int __sock_create(int family, int type, int protocol, struct socket **res
net_family_read_lock(); net_family_read_lock();
if (net_families[family] == NULL) { if (net_families[family] == NULL) {
i = -EAFNOSUPPORT; err = -EAFNOSUPPORT;
goto out; goto out;
} }
...@@ -1128,10 +1127,9 @@ static int __sock_create(int family, int type, int protocol, struct socket **res ...@@ -1128,10 +1127,9 @@ static int __sock_create(int family, int type, int protocol, struct socket **res
* default. * default.
*/ */
if (!(sock = sock_alloc())) if (!(sock = sock_alloc())) {
{
printk(KERN_WARNING "socket: no more sockets\n"); printk(KERN_WARNING "socket: no more sockets\n");
i = -ENFILE; /* Not exactly a match, but its the err = -ENFILE; /* Not exactly a match, but its the
closest posix thing */ closest posix thing */
goto out; goto out;
} }
...@@ -1142,11 +1140,11 @@ static int __sock_create(int family, int type, int protocol, struct socket **res ...@@ -1142,11 +1140,11 @@ static int __sock_create(int family, int type, int protocol, struct socket **res
* We will call the ->create function, that possibly is in a loadable * We will call the ->create function, that possibly is in a loadable
* module, so we have to bump that loadable module refcnt first. * module, so we have to bump that loadable module refcnt first.
*/ */
i = -EAFNOSUPPORT; err = -EAFNOSUPPORT;
if (!try_module_get(net_families[family]->owner)) if (!try_module_get(net_families[family]->owner))
goto out_release; goto out_release;
if ((i = net_families[family]->create(sock, protocol)) < 0) if ((err = net_families[family]->create(sock, protocol)) < 0)
goto out_module_put; goto out_module_put;
/* /*
* Now to bump the refcnt of the [loadable] module that owns this * Now to bump the refcnt of the [loadable] module that owns this
...@@ -1166,7 +1164,7 @@ static int __sock_create(int family, int type, int protocol, struct socket **res ...@@ -1166,7 +1164,7 @@ static int __sock_create(int family, int type, int protocol, struct socket **res
out: out:
net_family_read_unlock(); net_family_read_unlock();
return i; return err;
out_module_put: out_module_put:
module_put(net_families[family]->owner); module_put(net_families[family]->owner);
out_release: out_release:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment