efi_loader: superfluous statement in is_dir()
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Tue, 2 Oct 2018 03:57:32 +0000 (05:57 +0200)
committerAlexander Graf <agraf@suse.de>
Tue, 16 Oct 2018 14:39:57 +0000 (16:39 +0200)
When is_dir() is called we have already execute set_blk_dev(fh).
So don't call it again.

This fixes CoverityScan CID 184093.

Reported-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
lib/efi_loader/efi_file.c

index c1e285e9f7c96fb1df919724f6337b2350a8686d..beb4fba917d89fc6da8f47065152d41e6d6bf169 100644 (file)
@@ -52,11 +52,18 @@ static int set_blk_dev(struct file_handle *fh)
        return fs_set_blk_dev_with_part(fh->fs->desc, fh->fs->part);
 }
 
+/**
+ * is_dir() - check if file handle points to directory
+ *
+ * We assume that set_blk_dev(fh) has been called already.
+ *
+ * @fh:                file handle
+ * Return:     true if file handle points to a directory
+ */
 static int is_dir(struct file_handle *fh)
 {
        struct fs_dir_stream *dirs;
 
-       set_blk_dev(fh);
        dirs = fs_opendir(fh->path);
        if (!dirs)
                return 0;