diff --git a/fs/ext4/super.c b/fs/ext4/super.c index f70c5541d718..ca89590d1df5 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -4678,8 +4678,10 @@ static int ext4_commit_super(struct super_block *sb, int sync) struct buffer_head *sbh = EXT4_SB(sb)->s_sbh; int error = 0; - if (!sbh || block_device_ejected(sb)) - return error; + if (!sbh) + return -EINVAL; + if (block_device_ejected(sb)) + return -ENODEV; /* * If the file system is mounted read-only, don't update the