Skip to content

Commit 2816a09

Browse files
Luís Henriquesidryomov
authored andcommitted
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() is useless and can be dropped. Instead, move there the debug code that does the error checking so that it's only executed if ceph_get_inode() is called. Fixes: dd66df0 ("ceph: add support for encrypted snapshot names") Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: Luís Henriques <lhenriques@suse.de> Reviewed-by: Xiubo Li <xiubli@redhat.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
1 parent ce9ecca commit 2816a09

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

fs/ceph/crypto.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,9 @@ static struct inode *parse_longname(const struct inode *parent,
249249
if (!dir) {
250250
/* This can happen if we're not mounting cephfs on the root */
251251
dir = ceph_get_inode(parent->i_sb, vino, NULL);
252-
if (!dir)
253-
dir = ERR_PTR(-ENOENT);
252+
if (IS_ERR(dir))
253+
dout("Can't find inode %s (%s)\n", inode_number, name);
254254
}
255-
if (IS_ERR(dir))
256-
dout("Can't find inode %s (%s)\n", inode_number, name);
257255

258256
out:
259257
kfree(inode_number);

0 commit comments

Comments
 (0)