unsigned fid->fid cannot be negative
authorRoel Kluin <roel.kluin@gmail.com>
Tue, 28 Oct 2008 19:22:43 +0000 (14:22 -0500)
committerEric Van Hensbergen <ericvh@gmail.com>
Wed, 5 Nov 2008 19:19:07 +0000 (13:19 -0600)
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
net/9p/client.c

index b56d808..6e800dd 100644 (file)
@@ -608,7 +608,7 @@ reterr:
 
 static struct p9_fid *p9_fid_create(struct p9_client *clnt)
 {
-       int err;
+       int ret;
        struct p9_fid *fid;
        unsigned long flags;
 
@@ -617,11 +617,12 @@ static struct p9_fid *p9_fid_create(struct p9_client *clnt)
        if (!fid)
                return ERR_PTR(-ENOMEM);
 
-       fid->fid = p9_idpool_get(clnt->fidpool);
+       ret = p9_idpool_get(clnt->fidpool);
        if (fid->fid < 0) {
-               err = -ENOSPC;
+               ret = -ENOSPC;
                goto error;
        }
+       fid->fid = ret;
 
        memset(&fid->qid, 0, sizeof(struct p9_qid));
        fid->mode = -1;
@@ -638,7 +639,7 @@ static struct p9_fid *p9_fid_create(struct p9_client *clnt)
 
 error:
        kfree(fid);
-       return ERR_PTR(err);
+       return ERR_PTR(ret);
 }
 
 static void p9_fid_destroy(struct p9_fid *fid)