aboutsummaryrefslogtreecommitdiffstats
path: root/net/9p/client.c
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2011-05-20 14:55:52 -0400
committerEric Van Hensbergen <ericvh@gmail.com>2011-05-25 09:46:38 -0400
commitfe1cbabaea5e99a93bafe12fbf1b3b9cc71b610a (patch)
tree370e20e37796404602072f08b430ce04c6eb8188 /net/9p/client.c
parent398c4f0efb5c2f07fe2f5cd67031b15fd3e920c9 (diff)
net/9p: p9_idpool_get return -1 on error
We need to return -1 on error. Also handle error properly Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'net/9p/client.c')
-rw-r--r--net/9p/client.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/net/9p/client.c b/net/9p/client.c
index 5b705559a6b2..9e3b0e640da1 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -304,12 +304,13 @@ static int p9_tag_init(struct p9_client *c)
304 c->tagpool = p9_idpool_create(); 304 c->tagpool = p9_idpool_create();
305 if (IS_ERR(c->tagpool)) { 305 if (IS_ERR(c->tagpool)) {
306 err = PTR_ERR(c->tagpool); 306 err = PTR_ERR(c->tagpool);
307 c->tagpool = NULL;
308 goto error; 307 goto error;
309 } 308 }
310 309 err = p9_idpool_get(c->tagpool); /* reserve tag 0 */
311 p9_idpool_get(c->tagpool); /* reserve tag 0 */ 310 if (err < 0) {
312 311 p9_idpool_destroy(c->tagpool);
312 goto error;
313 }
313 c->max_tag = 0; 314 c->max_tag = 0;
314error: 315error:
315 return err; 316 return err;
@@ -789,11 +790,13 @@ struct p9_client *p9_client_create(const char *dev_name, char *options)
789 spin_lock_init(&clnt->lock); 790 spin_lock_init(&clnt->lock);
790 INIT_LIST_HEAD(&clnt->fidlist); 791 INIT_LIST_HEAD(&clnt->fidlist);
791 792
792 p9_tag_init(clnt); 793 err = p9_tag_init(clnt);
794 if (err < 0)
795 goto free_client;
793 796
794 err = parse_opts(options, clnt); 797 err = parse_opts(options, clnt);
795 if (err < 0) 798 if (err < 0)
796 goto free_client; 799 goto destroy_tagpool;
797 800
798 if (!clnt->trans_mod) 801 if (!clnt->trans_mod)
799 clnt->trans_mod = v9fs_get_default_trans(); 802 clnt->trans_mod = v9fs_get_default_trans();
@@ -802,13 +805,12 @@ struct p9_client *p9_client_create(const char *dev_name, char *options)
802 err = -EPROTONOSUPPORT; 805 err = -EPROTONOSUPPORT;
803 P9_DPRINTK(P9_DEBUG_ERROR, 806 P9_DPRINTK(P9_DEBUG_ERROR,
804 "No transport defined or default transport\n"); 807 "No transport defined or default transport\n");
805 goto free_client; 808 goto destroy_tagpool;
806 } 809 }
807 810
808 clnt->fidpool = p9_idpool_create(); 811 clnt->fidpool = p9_idpool_create();
809 if (IS_ERR(clnt->fidpool)) { 812 if (IS_ERR(clnt->fidpool)) {
810 err = PTR_ERR(clnt->fidpool); 813 err = PTR_ERR(clnt->fidpool);
811 clnt->fidpool = NULL;
812 goto put_trans; 814 goto put_trans;
813 } 815 }
814 816
@@ -834,6 +836,8 @@ destroy_fidpool:
834 p9_idpool_destroy(clnt->fidpool); 836 p9_idpool_destroy(clnt->fidpool);
835put_trans: 837put_trans:
836 v9fs_put_trans(clnt->trans_mod); 838 v9fs_put_trans(clnt->trans_mod);
839destroy_tagpool:
840 p9_idpool_destroy(clnt->tagpool);
837free_client: 841free_client:
838 kfree(clnt); 842 kfree(clnt);
839 return ERR_PTR(err); 843 return ERR_PTR(err);