ceph: remove unnecessary check for NULL in parse_longname()
PATCH 1/1 ceph: remove unnecessary check for NULL in parse_longname()
Function ceph_get_inode() never returns NULL; instead it returns an ERR_PTR() if something fails. Thus, the check for NULL in parse_longname() useless and can be dropped.
--- fs/ceph/crypto.c | 2 -- 1 file changed, 2 deletions(-)
fs/ceph/crypto.c +0 -2
@@ -249,8 +249,6 @@ static struct inode *parse_longname(const struct inode *parent,if (!dir) {/* This can happen if we're not mounting cephfs on the root */ dir =ceph_get_inode (parent->i_sb, vino,NULL ); -if (!dir) - dir =ERR_PTR (-ENOENT ); }if (IS_ERR (dir))dout ("Can't find inode %s (%s)\n" , inode_number, name);
Quoted 17 lines · Luís Henriques
Function
ceph_get_inode()never returns NULL; instead it returns anERR_PTR()if something fails. Thus, the check for NULL inparse_longname()useless and can be dropped.Fixes dd66df0053ef ("ceph: add support for encrypted snapshot names")Reported-by Dan Carpenter <[email protected]>Signed-off-by Luís Henriques <[email protected]>--- fs/ceph/crypto.c | 2 -- 1 file changed, 2 deletions(-)fs/ceph/crypto.c +0
-0
fs/ceph/crypto.c static struct inode *parse_longname(const struct inode *parent, · line 254
Quoted 8 lines
fs/ceph/crypto.c +0
-2@@ -249,8 +249,6 @@ static struct inode *parse_longname(const struct inode *parent,if (!dir) {/* This can happen if we're not mounting cephfs on the root */ dir =ceph_get_inode (parent->i_sb, vino,NULL ); -if (!dir) - dir =ERR_PTR (-ENOENT ); }if (IS_ERR (dir))dout ("Can't find inode %s (%s)\n" , inode_number, name);
Luis,
How about moving the error check into the 'if (!dir) {}' ? Because from 'ceph_find_inode()' the return value shouldn't be true here. This err check should for 'ceph_get_inode()' only.
Thanks
- Xiubo
Quoted 28 lines · Xiubo Li
Quoted 17 lines · Luís Henriques
Function
ceph_get_inode()never returns NULL; instead it returns anERR_PTR()if something fails. Thus, the check for NULL inparse_longname()useless and can be dropped.Fixes dd66df0053ef ("ceph: add support for encrypted snapshot names")Reported-by Dan Carpenter <[email protected]>Signed-off-by Luís Henriques <[email protected]>--- fs/ceph/crypto.c | 2 -- 1 file changed, 2 deletions(-)fs/ceph/crypto.c +0
-0fs/ceph/crypto.c static struct inode *parse_longname(const struct inode *parent, · line 254
Quoted 8 lines
fs/ceph/crypto.c +0
-2@@ -249,8 +249,6 @@ static struct inode *parse_longname(const struct inode *parent,if (!dir) {/* This can happen if we're not mounting cephfs on the root */ dir =ceph_get_inode (parent->i_sb, vino,NULL ); -if (!dir) - dir =ERR_PTR (-ENOENT ); }if (IS_ERR (dir))dout ("Can't find inode %s (%s)\n" , inode_number, name);Luis,
Quoted 3 lines
How about moving the error check into the 'if (!dir) {}' ? Because from '
ceph_find_inode()' the return value shouldn't be true here. This err check should for 'ceph_get_inode()' only.
Yeah, you're right. Thanks, Xiubo. I'll send out v2 shortly.
Cheers,
Signature · 1 line
Luís