From: Pali Rohár Date: Wed, 11 May 2022 18:28:28 +0000 (+0200) Subject: mmc: fsl_esdhc_spl: Fix checking for number of read sectors X-Git-Tag: baikal/mips/sdk5.9~3^2~47^2~1 X-Git-Url: https://git.baikalelectronics.ru/?a=commitdiff_plain;h=332edbef0a8af096f318a9b06d9339876858adea;p=uboot.git mmc: fsl_esdhc_spl: Fix checking for number of read sectors Commit d1c4d1f26b31 ("mmc: fsl_esdhc_spl: pre-PBL: implement redundancy support") changed number of sectors which are read but did not adjusted error check. Fix it and check for if correct number of sectors were read. Fixes: d1c4d1f26b31 ("mmc: fsl_esdhc_spl: pre-PBL: implement redundancy support") Signed-off-by: Pali Rohár Reviewed-by: Jaehoon Chung --- diff --git a/drivers/mmc/fsl_esdhc_spl.c b/drivers/mmc/fsl_esdhc_spl.c index ea8f4cd669..760f13d240 100644 --- a/drivers/mmc/fsl_esdhc_spl.c +++ b/drivers/mmc/fsl_esdhc_spl.c @@ -106,7 +106,7 @@ again: blk_off = (sector * 512) % mmc->read_bl_len; blk_cnt = DIV_ROUND_UP(512, mmc->read_bl_len); err = mmc->block_dev.block_read(&mmc->block_dev, blk_start, blk_cnt, tmp_buf); - if (err != 1) { + if (err != blk_cnt) { puts("spl: mmc read failed!!\n"); hang(); }