[U-Boot-Users] Bug in cfi_flash.c

Wolfgang Denk wd at denx.de
Wed Apr 26 15:03:56 CEST 2006


In message <444F81AF.32040.10275B0 at fuchs.ftz-leipzig.de> you wrote:
> 
> there is a bug in cfi_flash.c in function flash_get_size(). The problem appears if the board 
> specific CFG_MAX_FLASH_SECT macro is smaller than the real number of sectors. 

That's not a bug in the driver, but in your configuration then.

> In this case i use a 32 MiB Spansion flash (S29GL256), but we only want respectivly can use 
> 16 MiB of the flash because of the broken A24 line on the AT91RM9200. Therefore i defined 
> CFG_MAX_FLASH_SECT to 128, but the real value is 256. The structure allocation of 

This is not correct. You should not lie to the driver. Don't complain
if he refuses to work for you.

> flash_info_t in flash.h defines the size of the protect array to CFG_MAX_FLASH_SECT (in 
> my case 128). The for-loop in flash_get_size() initialises this array, but it does it for all 
> sectors (erase_region_count) which is 256 in my case. This will cause the info->portwidth 
> variable (and of course all following too) to be overwritten.

This should be fixed. It should complain about the misconfiguration and die.

Please submit a patch.

> --Alt-Boundary-8434.16938416
> Content-type: text/html; charset=US-ASCII
> Content-transfer-encoding: 7BIT
> Content-description: Mail message body

And never post HTML here!

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Winners never talk about glorious victories. That's  because  they're
the  ones  who  see  what the battlefield looks like afterwards. It's
only the losers who have glorious victories.
                                      - Terry Pratchett, _Small Gods_




More information about the U-Boot mailing list