From: Antonio Borneo Date: Thu, 18 Nov 2010 07:01:03 +0000 (+0800) Subject: NOR/SPEARSMI: fix segfault X-Git-Tag: v0.5.0-rc1~315 X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=commitdiff_plain;h=e6fc371e2e86a00c7e84004b94c4b8374634953d 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 --- diff --git a/src/flash/nor/spearsmi.c b/src/flash/nor/spearsmi.c index c3bc2ec585..5e6a2c472a 100644 --- a/src/flash/nor/spearsmi.c +++ b/src/flash/nor/spearsmi.c @@ -647,6 +647,7 @@ static int spearsmi_probe(struct flash_bank *bank) if (retval != ERROR_OK) return retval; + spearsmi_info->dev = NULL; for (struct flash_device *p = flash_devices; p->name ; p++) if (p->device_id == id) { spearsmi_info->dev = p;