9p: Remove unnecessary IS_ERR() check
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 1 Dec 2020 07:04:34 +0000 (10:04 +0300)
committerDominique Martinet <asmadeus@codewreck.org>
Tue, 1 Dec 2020 07:19:02 +0000 (08:19 +0100)
The "fid" variable can't be an error pointer so there is no need to
check.  The code is slightly cleaner if we move the increment before
the break and remove the NULL check as well.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
fs/9p/fid.c

index 79837f1b1c91355db9209db437e1fde53cf391ec..9d9de62592be22e3a331eafc3556a190708fc698 100644 (file)
@@ -56,12 +56,11 @@ static struct p9_fid *v9fs_fid_find_inode(struct inode *inode, kuid_t uid)
        h = (struct hlist_head *)&inode->i_private;
        hlist_for_each_entry(fid, h, ilist) {
                if (uid_eq(fid->uid, uid)) {
+                       refcount_inc(&fid->count);
                        ret = fid;
                        break;
                }
        }
-       if (ret && !IS_ERR(ret))
-               refcount_inc(&ret->count);
        spin_unlock(&inode->i_lock);
        return ret;
 }