Commit a75500c5 authored by Valdis Kletnieks's avatar Valdis Kletnieks Committed by Greg Kroah-Hartman

staging: exfat: Clean up return codes - FFS_MEDIAERR

Convert FFS_MEDIAERR to (mostly) -ENOENT and -EIO.  Some additional code surgery
needed to propogate correct error codes upwards.
Signed-off-by: default avatarValdis Kletnieks <Valdis.Kletnieks@vt.edu>
Link: https://lore.kernel.org/r/20191112021000.42091-3-Valdis.Kletnieks@vt.eduSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 133c8874
......@@ -210,7 +210,6 @@ static inline u16 get_row_index(u16 i)
/* return values */
#define FFS_SUCCESS 0
#define FFS_MEDIAERR 1
#define FFS_MOUNTED 3
#define FFS_NOTMOUNTED 4
#define FFS_ALIGNMENTERR 5
......
......@@ -40,11 +40,11 @@ int bdev_read(struct super_block *sb, sector_t secno, struct buffer_head **bh,
long flags = sbi->debug_flags;
if (flags & EXFAT_DEBUGFLAGS_ERROR_RW)
return FFS_MEDIAERR;
return -EIO;
#endif /* CONFIG_EXFAT_KERNEL_DEBUG */
if (!p_bd->opened)
return FFS_MEDIAERR;
return -ENODEV;
if (*bh)
__brelse(*bh);
......@@ -62,7 +62,7 @@ int bdev_read(struct super_block *sb, sector_t secno, struct buffer_head **bh,
WARN(!p_fs->dev_ejected,
"[EXFAT] No bh, device seems wrong or to be ejected.\n");
return FFS_MEDIAERR;
return -EIO;
}
int bdev_write(struct super_block *sb, sector_t secno, struct buffer_head *bh,
......@@ -77,11 +77,11 @@ int bdev_write(struct super_block *sb, sector_t secno, struct buffer_head *bh,
long flags = sbi->debug_flags;
if (flags & EXFAT_DEBUGFLAGS_ERROR_RW)
return FFS_MEDIAERR;
return -EIO;
#endif /* CONFIG_EXFAT_KERNEL_DEBUG */
if (!p_bd->opened)
return FFS_MEDIAERR;
return -ENODEV;
if (secno == bh->b_blocknr) {
lock_buffer(bh);
......@@ -89,7 +89,7 @@ int bdev_write(struct super_block *sb, sector_t secno, struct buffer_head *bh,
mark_buffer_dirty(bh);
unlock_buffer(bh);
if (sync && (sync_dirty_buffer(bh) != 0))
return FFS_MEDIAERR;
return -EIO;
} else {
count = num_secs << p_bd->sector_size_bits;
......@@ -115,7 +115,7 @@ int bdev_write(struct super_block *sb, sector_t secno, struct buffer_head *bh,
WARN(!p_fs->dev_ejected,
"[EXFAT] No bh, device seems wrong or to be ejected.\n");
return FFS_MEDIAERR;
return -EIO;
}
int bdev_sync(struct super_block *sb)
......@@ -126,11 +126,11 @@ int bdev_sync(struct super_block *sb)
long flags = sbi->debug_flags;
if (flags & EXFAT_DEBUGFLAGS_ERROR_RW)
return FFS_MEDIAERR;
return -EIO;
#endif /* CONFIG_EXFAT_KERNEL_DEBUG */
if (!p_bd->opened)
return FFS_MEDIAERR;
return -ENODEV;
return sync_blockdev(sb->s_bdev);
}
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment