]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
fs: Fix return in jfs_mkdir and orangefs_mkdir
authorHongling Zeng <zenghongling@kylinos.cn>
Fri, 1 May 2026 07:10:58 +0000 (15:10 +0800)
committerChristian Brauner <brauner@kernel.org>
Mon, 11 May 2026 12:19:01 +0000 (14:19 +0200)
Return NULL instead of passing to ERR_PTR while err is zero
Fixes these smatch warnings:
  - fs/jfs/namei.c:311 jfs_mkdir() warn: passing zero to 'ERR_PTR'
  - fs/orangefs/namei.c:369 orangefs_mkdir() warn: passing zero
    to 'ERR_PTR'

Fixes: 88d5baf69082 ("Change inode_operations.mkdir to return struct dentry *")
Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn>
Link: https://patch.msgid.link/20260501071058.1243245-1-zenghongling@kylinos.cn
Reviewed-by: Jori Koolstra <jkoolstra@xs4all.nl>
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/jfs/namei.c
fs/orangefs/namei.c

index 60c4a0e0fca5ea3a53ab7d9af877183ef59879a2..442d6267926227b191bd46601056fc28f069ae34 100644 (file)
@@ -309,7 +309,7 @@ static struct dentry *jfs_mkdir(struct mnt_idmap *idmap, struct inode *dip,
       out1:
 
        jfs_info("jfs_mkdir: rc:%d", rc);
-       return ERR_PTR(rc);
+       return rc ? ERR_PTR(rc) : NULL;
 }
 
 /*
index bec5475de094dada6bb29eaf8520a875880f3bab..75e65e72c2d64614fc71ab26a47abce18fc927ee 100644 (file)
@@ -362,7 +362,7 @@ static struct dentry *orangefs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
        __orangefs_setattr(dir, &iattr);
 out:
        op_release(new_op);
-       return ERR_PTR(ret);
+       return ret ? ERR_PTR(ret) : NULL;
 }
 
 static int orangefs_rename(struct mnt_idmap *idmap,