Signed-off-by: Chris Mason <chris.mason@oracle.com>
        struct btrfs_root *dev_root = kmalloc(sizeof(struct btrfs_root),
                                              GFP_NOFS);
        int ret;
-       int err = -EIO;
+       int err = -EINVAL;
        struct btrfs_super_block *disk_super;
-
        if (!extent_root || !tree_root || !fs_info) {
                err = -ENOMEM;
                goto fail;
 
 
        tree_root = open_ctree(sb, fs_devices);
 
-       if (!tree_root || IS_ERR(tree_root)) {
+       if (IS_ERR(tree_root)) {
                printk("btrfs: open_ctree failed\n");
-               return -EIO;
+               return PTR_ERR(tree_root);
        }
        sb->s_fs_info = tree_root;
        disk_super = &tree_root->fs_info->super_copy;
 
        if (strncmp((char *)(&disk_super->magic), BTRFS_MAGIC,
            sizeof(disk_super->magic))) {
                printk("no btrfs found on %s\n", path);
-               ret = -ENOENT;
+               ret = -EINVAL;
                goto error_brelse;
        }
        devid = le64_to_cpu(disk_super->dev_item.devid);