NOR/SPEARSMI: fix segfault

If flash chip is not listed in the table, or if no flash is
connected, pointer must be properly initialized.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
Antonio Borneo 2010-11-18 15:01:03 +08:00 committed by Øyvind Harboe
parent 06b4903e3e
commit e6fc371e2e
1 changed files with 1 additions and 0 deletions

View File

@ -647,6 +647,7 @@ static int spearsmi_probe(struct flash_bank *bank)
if (retval != ERROR_OK) if (retval != ERROR_OK)
return retval; return retval;
spearsmi_info->dev = NULL;
for (struct flash_device *p = flash_devices; p->name ; p++) for (struct flash_device *p = flash_devices; p->name ; p++)
if (p->device_id == id) { if (p->device_id == id) {
spearsmi_info->dev = p; spearsmi_info->dev = p;