ocfs2: fix passing zero to 'PTR_ERR' warning
authorDing Xiang <dingxiang@cmss.chinamobile.com>
Sun, 1 Dec 2019 01:49:12 +0000 (17:49 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 1 Dec 2019 14:29:17 +0000 (06:29 -0800)
Fix a static code checker warning:
fs/ocfs2/acl.c:331
ocfs2_acl_chmod() warn: passing zero to 'PTR_ERR'

Link: http://lkml.kernel.org/r/1dee278b-6c96-eec2-ce76-fe6e07c6e20f@linux.alibaba.com
Fixes: 5ee0fbd50fd ("ocfs2: revert using ocfs2_acl_chmod to avoid inode cluster lock hang")
Signed-off-by: Ding Xiang <dingxiang@cmss.chinamobile.com>
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Gang He <ghe@suse.com>
Cc: Jun Piao <piaojun@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/ocfs2/acl.c

index 3e7da392aa6f89c588ae67cbf8d10ec5c862da50..bb981ec76456b40a17c5fdbfa91e8f33eaaf3635 100644 (file)
@@ -327,8 +327,8 @@ int ocfs2_acl_chmod(struct inode *inode, struct buffer_head *bh)
        down_read(&OCFS2_I(inode)->ip_xattr_sem);
        acl = ocfs2_get_acl_nolock(inode, ACL_TYPE_ACCESS, bh);
        up_read(&OCFS2_I(inode)->ip_xattr_sem);
-       if (IS_ERR(acl) || !acl)
-               return PTR_ERR(acl);
+       if (IS_ERR_OR_NULL(acl))
+               return PTR_ERR_OR_ZERO(acl);
        ret = __posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
        if (ret)
                return ret;