diff options
author | \"J. Bruce Fields\ <bfields@citi.umich.edu> | 2008-12-23 16:07:13 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2008-12-23 16:07:13 -0500 |
commit | db75b3d6b5b0dad29860370618ea94d2726641b4 (patch) | |
tree | e20ac4190fe09d27f7a48e7f3f46cce6f2dbd5b1 /net | |
parent | b03568c32226163cb3588ea8993adb268ed497a5 (diff) |
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: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/sunrpc/auth_gss/auth_gss.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index 0fe35664c687..bc512fff8a41 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c | |||
@@ -329,16 +329,16 @@ gss_alloc_msg(struct gss_auth *gss_auth, uid_t uid) | |||
329 | struct gss_upcall_msg *gss_msg; | 329 | struct gss_upcall_msg *gss_msg; |
330 | 330 | ||
331 | gss_msg = kzalloc(sizeof(*gss_msg), GFP_NOFS); | 331 | gss_msg = kzalloc(sizeof(*gss_msg), GFP_NOFS); |
332 | if (gss_msg != NULL) { | 332 | if (gss_msg == NULL) |
333 | INIT_LIST_HEAD(&gss_msg->list); | 333 | return ERR_PTR(-ENOMEM); |
334 | rpc_init_wait_queue(&gss_msg->rpc_waitqueue, "RPCSEC_GSS upcall waitq"); | 334 | INIT_LIST_HEAD(&gss_msg->list); |
335 | init_waitqueue_head(&gss_msg->waitqueue); | 335 | rpc_init_wait_queue(&gss_msg->rpc_waitqueue, "RPCSEC_GSS upcall waitq"); |
336 | atomic_set(&gss_msg->count, 1); | 336 | init_waitqueue_head(&gss_msg->waitqueue); |
337 | gss_msg->msg.data = &gss_msg->uid; | 337 | atomic_set(&gss_msg->count, 1); |
338 | gss_msg->msg.len = sizeof(gss_msg->uid); | 338 | gss_msg->msg.data = &gss_msg->uid; |
339 | gss_msg->uid = uid; | 339 | gss_msg->msg.len = sizeof(gss_msg->uid); |
340 | gss_msg->auth = gss_auth; | 340 | gss_msg->uid = uid; |
341 | } | 341 | gss_msg->auth = gss_auth; |
342 | return gss_msg; | 342 | return gss_msg; |
343 | } | 343 | } |
344 | 344 | ||
@@ -355,8 +355,8 @@ gss_setup_upcall(struct rpc_clnt *clnt, struct gss_auth *gss_auth, struct rpc_cr | |||
355 | uid = 0; | 355 | uid = 0; |
356 | 356 | ||
357 | gss_new = gss_alloc_msg(gss_auth, uid); | 357 | gss_new = gss_alloc_msg(gss_auth, uid); |
358 | if (gss_new == NULL) | 358 | if (IS_ERR(gss_new)) |
359 | return ERR_PTR(-ENOMEM); | 359 | return gss_new; |
360 | gss_msg = gss_add_msg(gss_auth, gss_new); | 360 | gss_msg = gss_add_msg(gss_auth, gss_new); |
361 | if (gss_msg == gss_new) { | 361 | if (gss_msg == gss_new) { |
362 | int res = rpc_queue_upcall(gss_auth->dentry->d_inode, &gss_new->msg); | 362 | int res = rpc_queue_upcall(gss_auth->dentry->d_inode, &gss_new->msg); |