erofs: fix return value check in erofs_read_superblock()

In case of error, the function read_mapping_page() returns
ERR_PTR() not NULL. The NULL test in the return value check
should be replaced with IS_ERR().

Fixes: fe7c242357 ("erofs: use read_mapping_page instead of sb_bread")
Reviewed-by: Gao Xiang <gaoxiang25@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Link: https://lore.kernel.org/r/20190918083033.47780-1-weiyongjun1@huawei.com
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
This commit is contained in:
Wei Yongjun 2019-09-18 08:30:33 +00:00 committed by Gao Xiang
parent 54ecb8f702
commit 517d6b9c6f
1 changed files with 2 additions and 2 deletions

View File

@ -105,9 +105,9 @@ static int erofs_read_superblock(struct super_block *sb)
int ret;
page = read_mapping_page(sb->s_bdev->bd_inode->i_mapping, 0, NULL);
if (!page) {
if (IS_ERR(page)) {
erofs_err(sb, "cannot read erofs superblock");
return -EIO;
return PTR_ERR(page);
}
sbi = EROFS_SB(sb);