Commit db75b3d6 authored by \"J. Bruce Fields\'s avatar \"J. Bruce Fields\ Committed by Trond Myklebust

rpc: minor gss_alloc_msg cleanup

I want to add a little more code here, so it'll be convenient to have
this flatter.

Also, I'll want to add another error condition, so it'll be more
convenient to return -ENOMEM than NULL in the error case.  The only
caller is already converting NULL to -ENOMEM anyway.
Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent b03568c3
...@@ -329,7 +329,8 @@ gss_alloc_msg(struct gss_auth *gss_auth, uid_t uid) ...@@ -329,7 +329,8 @@ gss_alloc_msg(struct gss_auth *gss_auth, uid_t uid)
struct gss_upcall_msg *gss_msg; struct gss_upcall_msg *gss_msg;
gss_msg = kzalloc(sizeof(*gss_msg), GFP_NOFS); gss_msg = kzalloc(sizeof(*gss_msg), GFP_NOFS);
if (gss_msg != NULL) { if (gss_msg == NULL)
return ERR_PTR(-ENOMEM);
INIT_LIST_HEAD(&gss_msg->list); INIT_LIST_HEAD(&gss_msg->list);
rpc_init_wait_queue(&gss_msg->rpc_waitqueue, "RPCSEC_GSS upcall waitq"); rpc_init_wait_queue(&gss_msg->rpc_waitqueue, "RPCSEC_GSS upcall waitq");
init_waitqueue_head(&gss_msg->waitqueue); init_waitqueue_head(&gss_msg->waitqueue);
...@@ -338,7 +339,6 @@ gss_alloc_msg(struct gss_auth *gss_auth, uid_t uid) ...@@ -338,7 +339,6 @@ gss_alloc_msg(struct gss_auth *gss_auth, uid_t uid)
gss_msg->msg.len = sizeof(gss_msg->uid); gss_msg->msg.len = sizeof(gss_msg->uid);
gss_msg->uid = uid; gss_msg->uid = uid;
gss_msg->auth = gss_auth; gss_msg->auth = gss_auth;
}
return gss_msg; return gss_msg;
} }
...@@ -355,8 +355,8 @@ gss_setup_upcall(struct rpc_clnt *clnt, struct gss_auth *gss_auth, struct rpc_cr ...@@ -355,8 +355,8 @@ gss_setup_upcall(struct rpc_clnt *clnt, struct gss_auth *gss_auth, struct rpc_cr
uid = 0; uid = 0;
gss_new = gss_alloc_msg(gss_auth, uid); gss_new = gss_alloc_msg(gss_auth, uid);
if (gss_new == NULL) if (IS_ERR(gss_new))
return ERR_PTR(-ENOMEM); return gss_new;
gss_msg = gss_add_msg(gss_auth, gss_new); gss_msg = gss_add_msg(gss_auth, gss_new);
if (gss_msg == gss_new) { if (gss_msg == gss_new) {
int res = rpc_queue_upcall(gss_auth->dentry->d_inode, &gss_new->msg); int res = rpc_queue_upcall(gss_auth->dentry->d_inode, &gss_new->msg);
......
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