All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] NFS: Check if rpcauth_create() returns an error code
@ 2012-06-26 18:12 bjschuma
  2012-06-26 18:23 ` Chuck Lever
  0 siblings, 1 reply; 6+ messages in thread
From: bjschuma @ 2012-06-26 18:12 UTC (permalink / raw)
  To: Trond.Myklebust; +Cc: linux-nfs, chuck.lever

From: Bryan Schumaker <bjschuma@netapp.com>

I was treating a NULL return value as an error, but this function will
instead return an ERR_PTR().  Now that I'm checking if the function
returns an error, I should also pass the error up the call stack.

Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
---
 fs/nfs/nfs4namespace.c |  4 ++--
 fs/nfs/nfs4proc.c      | 15 ++++-----------
 2 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/fs/nfs/nfs4namespace.c b/fs/nfs/nfs4namespace.c
index 017b4b0..a8aafc6 100644
--- a/fs/nfs/nfs4namespace.c
+++ b/fs/nfs/nfs4namespace.c
@@ -205,9 +205,9 @@ struct rpc_clnt *nfs4_create_sec_client(struct rpc_clnt *clnt, struct inode *ino
 		return clone;
 
 	auth = rpcauth_create(flavor, clone);
-	if (!auth) {
+	if (IS_ERR(auth)) {
 		rpc_shutdown_client(clone);
-		clone = ERR_PTR(-EIO);
+		clone = ERR_CAST(auth);
 	}
 
 	return clone;
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 5a7b372..f817587 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -2356,17 +2356,10 @@ out:
 static int nfs4_lookup_root_sec(struct nfs_server *server, struct nfs_fh *fhandle,
 				struct nfs_fsinfo *info, rpc_authflavor_t flavor)
 {
-	struct rpc_auth *auth;
-	int ret;
-
-	auth = rpcauth_create(flavor, server->client);
-	if (!auth) {
-		ret = -EIO;
-		goto out;
-	}
-	ret = nfs4_lookup_root(server, fhandle, info);
-out:
-	return ret;
+	struct rpc_auth *auth = rpcauth_create(flavor, server->client);
+	if (IS_ERR(auth))
+		return PTR_ERR(auth);
+	return nfs4_lookup_root(server, fhandle, info);
 }
 
 static int nfs4_find_root_sec(struct nfs_server *server, struct nfs_fh *fhandle,
-- 
1.7.11.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-06-26 22:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-26 18:12 [PATCH] NFS: Check if rpcauth_create() returns an error code bjschuma
2012-06-26 18:23 ` Chuck Lever
2012-06-26 19:00   ` Bryan Schumaker
2012-06-26 19:11     ` Chuck Lever
2012-06-26 21:34     ` Chuck Lever
2012-06-26 22:02       ` Myklebust, Trond

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.