[PATCH v6 01/11] erofs-utils: lib: remove unneeded NULL checking for returned item

Jingbo Xu jefflexu at linux.alibaba.com
Tue Sep 5 20:02:17 AEST 2023


get_xattritem() will in no way return NULL.

Signed-off-by: Jingbo Xu <jefflexu at linux.alibaba.com>
---
 lib/xattr.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/lib/xattr.c b/lib/xattr.c
index 0cab29f..5acc1ae 100644
--- a/lib/xattr.c
+++ b/lib/xattr.c
@@ -437,8 +437,6 @@ int erofs_setxattr(struct erofs_inode *inode, char *key,
 	item = get_xattritem(prefix, kvbuf, len);
 	if (IS_ERR(item))
 		return PTR_ERR(item);
-	if (!item)
-		return 0;
 
 	return erofs_xattr_add(&inode->i_xattrs, item);
 }
@@ -473,8 +471,6 @@ static int erofs_droid_xattr_set_caps(struct erofs_inode *inode)
 	item = get_xattritem(EROFS_XATTR_INDEX_SECURITY, kvbuf, len);
 	if (IS_ERR(item))
 		return PTR_ERR(item);
-	if (!item)
-		return 0;
 
 	return erofs_xattr_add(&inode->i_xattrs, item);
 }
-- 
2.19.1.6.gb485710b



More information about the Linux-erofs mailing list