From: Chuck Lever Date: Wed, 20 Oct 2010 15:52:51 +0000 (-0400) Subject: SUNRPC: Use conventional switch statement when reclassifying sockets X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4232e8634ad82c5a53389e4016de15a8b15c09c3;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git SUNRPC: Use conventional switch statement when reclassifying sockets Clean up. Defensive coding: If "family" is ever something that is neither AF_INET nor AF_INET6, xs_reclassify_socket6() is not the appropriate default action. Choose to do nothing in that case. Introduced by commit 6bc9638a. Signed-off-by: Chuck Lever Signed-off-by: J. Bruce Fields --- diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 79155650b7b9..b58eef76a518 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c @@ -1558,7 +1558,7 @@ static int xs_bind(struct sock_xprt *transport, struct socket *sock) nloop++; } while (err == -EADDRINUSE && nloop != 2); - if (myaddr.ss_family == PF_INET) + if (myaddr.ss_family == AF_INET) dprintk("RPC: %s %pI4:%u: %s (%d)\n", __func__, &((struct sockaddr_in *)&myaddr)->sin_addr, port, err ? "failed" : "ok", err); @@ -1594,10 +1594,14 @@ static inline void xs_reclassify_socket6(struct socket *sock) static inline void xs_reclassify_socket(int family, struct socket *sock) { - if (family == PF_INET) + switch (family) { + case AF_INET: xs_reclassify_socket4(sock); - else + break; + case AF_INET6: xs_reclassify_socket6(sock); + break; + } } #else static inline void xs_reclassify_socket4(struct socket *sock)