diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 8467be0cce60..c7f5b665834f 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -5489,8 +5489,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