9
0
Fork 0

cfi driver: Limit device size to actual size

When probing CFI, limit the device size to the actual probed size of
the flash

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2008-12-17 18:18:44 +01:00
parent 7e9bb400cf
commit db572dce5f
1 changed files with 6 additions and 0 deletions

View File

@ -316,6 +316,12 @@ static int cfi_probe (struct device_d *dev)
/* Init: no FLASHes known */
info->flash_id = FLASH_UNKNOWN;
size += info->size = flash_get_size(info, dev->map_base);
if (dev->size > size) {
dev_dbg(dev, "limiting size from 0x%08x to 0x%08x\n", dev->size, size);
dev->size = size;
}
if (info->flash_id == FLASH_UNKNOWN) {
debug ("## Unknown FLASH on Bank at 0x%08x - Size = 0x%08lx = %ld MB\n",
dev->map_base, info->size, info->size << 20);