When marking the trailing blocks on a device as reserved for Bad Block Table usage, ensure that the correct blocks are marked. This resolves an off-by-one error that was marking one block too low and leaving the last block in the device unmarked. --- bsps/shared/dev/nand/xnandpsu_bbm.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/bsps/shared/dev/nand/xnandpsu_bbm.c b/bsps/shared/dev/nand/xnandpsu_bbm.c index d1b7d5a39d..4fb62b2f6d 100644 --- a/bsps/shared/dev/nand/xnandpsu_bbm.c +++ b/bsps/shared/dev/nand/xnandpsu_bbm.c @@ -830,7 +830,11 @@ static s32 XNandPsu_MarkBbt(XNandPsu* InstancePtr, XNandPsu_BbtDesc *Desc, /* Mark the last four blocks as Reserved */ BlockIndex = ((Target + (u32)1) * InstancePtr->Geometry.NumTargetBlocks) - +#ifdef __rtems__ + Desc->MaxBlocks; +#else Desc->MaxBlocks - (u32)1; +#endif for(Index = 0U; Index < Desc->MaxBlocks; Index++) { -- 2.39.2 _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel