linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Emelyanov <xemul@parallels.com>
To: "J. Bruce Fields" <bfields@fieldses.org>,
	"linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>
Subject: [PATCH] sunrpc: Don't return NULL from rpcb_create
Date: Tue, 05 Oct 2010 20:48:48 +0400	[thread overview]
Message-ID: <4CAB56F0.9000504@parallels.com> (raw)

Its callers check for ERR_PTR.

However grep shows that nobody calls this with sa_familiy other than
AF_INET/AF_INET6 so this case can be simply dropped.

Furthermore - the remaining code can be replaced with the existing helper.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
---
 net/sunrpc/rpcb_clnt.c |   12 +-----------
 1 files changed, 1 insertions(+), 11 deletions(-)

diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c
index 83af38d..620dee7 100644
--- a/net/sunrpc/rpcb_clnt.c
+++ b/net/sunrpc/rpcb_clnt.c
@@ -241,17 +241,7 @@ static struct rpc_clnt *rpcb_create(char *hostname, struct sockaddr *srvaddr,
 					RPC_CLNT_CREATE_NONPRIVPORT),
 	};
 
-	switch (srvaddr->sa_family) {
-	case AF_INET:
-		((struct sockaddr_in *)srvaddr)->sin_port = htons(RPCBIND_PORT);
-		break;
-	case AF_INET6:
-		((struct sockaddr_in6 *)srvaddr)->sin6_port = htons(RPCBIND_PORT);
-		break;
-	default:
-		return NULL;
-	}
-
+	rpc_set_port(srvaddr, RPCBIND_PORT);
 	return rpc_create(&args);
 }
 
-- 
1.5.5.6


             reply	other threads:[~2010-10-05 16:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-05 16:48 Pavel Emelyanov [this message]
2010-10-06  2:55 ` [PATCH] sunrpc: Don't return NULL from rpcb_create Chuck Lever
2010-10-06  9:45   ` [PATCH v2] " Pavel Emelyanov
2010-10-12  0:03     ` J. Bruce Fields

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CAB56F0.9000504@parallels.com \
    --to=xemul@parallels.com \
    --cc=bfields@fieldses.org \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).