[U-Boot-Users] [PATCH] complains on bad CFG_MAX_FLASH_SECT description

Mirco Fuchs mircofuchs at web.de
Fri Apr 28 08:42:05 CEST 2006


Hello,

this Patch complains if the macro CFG_MAX_FLASH_SECT is smaller than 
the truly available flash sectors.

best regards
Mirco

Signed-off-by: Mirco Fuchs <mircofuchs at web.de>

---

--- u-boot_1.1.4/u-boot-1.1.4/drivers/cfi_flash.c	2006-03-12 02:13:21.000000000 +0100
+++ u-boot-1.1.4/drivers/cfi_flash.c	2006-04-27 17:41:54.495071792 
+0200
@@ -1131,6 +1131,10 @@ ulong flash_get_size (ulong base, int ba
 			erase_region_count = (tmp & 0xffff) + 1;
 			debug ("erase_region_count = %d erase_region_size = %d\n",
 				erase_region_count, erase_region_size);
+			if (erase_region_count > CFG_MAX_FLASH_SECT) {
+				printf ("*** Warning - nbr. of erase regions > CFG_MAX_FLASH_SECT\n");
+				return 0;
+			}
 			for (j = 0; j < erase_region_count; j++) {
 				info->start[sect_cnt] = sector;
 				sector += (erase_region_size * size_ratio);




More information about the U-Boot mailing list