Skip to contentSkip to conversation

mmc: fsl_esdhc_spl: Fix checking for number of read sectors

PATCH In review Pali Rohár 3 participants 3 messages May 11, 2022 – May 23, 2022 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: fsl_esdhc_spl: Fix checking for number of read sectors

Commit 0980cbba7b3c ("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 0980cbba7b3c ("mmc: fsl_esdhc_spl: pre-PBL: implement redundancy support")
---
 drivers/mmc/fsl_esdhc_spl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/fsl_esdhc_spl.c +1 -1
index ea8f4cd66964..760f13d24018 100644
@@ -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();
 	}
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Pali Rohár

Commit 0980cbba7b3c ("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 0980cbba7b3c ("mmc: fsl_esdhc_spl: pre-PBL: implement redundancy support")

Best Regards,
Jaehoon Chung

Quoted 17 lines
---
 drivers/mmc/fsl_esdhc_spl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/fsl_esdhc_spl.c +1 -1
index ea8f4cd66964..760f13d24018 100644
@@ -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();
 	}
#2 lore raw
In reply to Pali Rohár
Quoted 9 lines · Pali Rohár

Commit 0980cbba7b3c ("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 0980cbba7b3c ("mmc: fsl_esdhc_spl: pre-PBL: implement redundancy support")

Applied to u-boot/master, thanks!

Signature · 1 line
Tom