Skip to contentSkip to conversation

spl: fit: nand: fix fit loading on bad blocks

PATCH New Jit Loon Lim 1 participant 1 message Dec 11, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spl: fit: nand: fix fit loading on bad blocks

From: Tien Fong Chee <[email protected]>

The offset at which the image to be loaded from NAND is located is retrieved from the itb header. The presence of bad blocks in the area of the NAND where the itb image is located could invalidate the offset which must therefore be adjusted taking into account the state of the sectors concerned.

---
 common/spl/spl_nand.c         |  3 +-
 drivers/mtd/nand/raw/denali.c | 91 ++++++++++++++++++++++++++++++++++-
 2 files changed, 92 insertions(+), 2 deletions(-)
common/spl/spl_nand.c +2 -1
index 7b7579a2df..d94148ec71 100644
@@ -45,10 +45,11 @@ static ulong spl_nand_fit_read(struct spl_load_info *load, ulong offs,
 	int err;
 	ulong sector;
 
-	sector = *(int *)load->priv;
 	offs *= load->bl_len;
 	size *= load->bl_len;
+	sector = *(int *)load->priv;
 	offs = sector + nand_spl_adjust_offset(sector, offs - sector);
+
 	err = nand_spl_load_image(offs, size, dst);
 	if (err)
 		return 0;
drivers/mtd/nand/raw/denali.c +90 -1

100 lines not on this page · raw message

Signature · 1 line
2.26.2