summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/flash/nor/avrf.c6
-rw-r--r--src/flash/nor/pic32mx.c6
-rw-r--r--src/flash/nor/stellaris.c6
-rw-r--r--src/flash/nor/stm32x.c6
-rw-r--r--src/flash/nor/tms470.c6
5 files changed, 30 insertions, 0 deletions
diff --git a/src/flash/nor/avrf.c b/src/flash/nor/avrf.c
index 7cdab519..8472d836 100644
--- a/src/flash/nor/avrf.c
+++ b/src/flash/nor/avrf.c
@@ -324,6 +324,12 @@ static int avrf_probe(struct flash_bank *bank)
if (avr_info != NULL)
{
+ if (bank->sectors)
+ {
+ free(bank->sectors);
+ bank->sectors = NULL;
+ }
+
// chip found
bank->base = 0x00000000;
bank->size = (avr_info->flash_page_size * avr_info->flash_page_num);
diff --git a/src/flash/nor/pic32mx.c b/src/flash/nor/pic32mx.c
index 58009ae5..2fe864d4 100644
--- a/src/flash/nor/pic32mx.c
+++ b/src/flash/nor/pic32mx.c
@@ -560,6 +560,12 @@ static int pic32mx_probe(struct flash_bank *bank)
LOG_INFO("flash size = %" PRId32 "kbytes", num_pages / 1024);
+ if (bank->sectors)
+ {
+ free(bank->sectors);
+ bank->sectors = NULL;
+ }
+
/* calculate numbers of pages */
num_pages /= page_size;
bank->size = (num_pages * page_size);
diff --git a/src/flash/nor/stellaris.c b/src/flash/nor/stellaris.c
index 38374ffe..f7e2e8d9 100644
--- a/src/flash/nor/stellaris.c
+++ b/src/flash/nor/stellaris.c
@@ -1065,6 +1065,12 @@ static int stellaris_probe(struct flash_bank *bank)
if (retval != ERROR_OK)
return retval;
+ if (bank->sectors)
+ {
+ free(bank->sectors);
+ bank->sectors = NULL;
+ }
+
/* provide this for the benefit of the NOR flash framework */
bank->size = 1024 * stellaris_info->num_pages;
bank->num_sectors = stellaris_info->num_pages;
diff --git a/src/flash/nor/stm32x.c b/src/flash/nor/stm32x.c
index d11a8edc..8a3b8323 100644
--- a/src/flash/nor/stm32x.c
+++ b/src/flash/nor/stm32x.c
@@ -775,6 +775,12 @@ static int stm32x_probe(struct flash_bank *bank)
/* calculate numbers of pages */
num_pages /= (page_size / 1024);
+ if (bank->sectors)
+ {
+ free(bank->sectors);
+ bank->sectors = NULL;
+ }
+
bank->base = 0x08000000;
bank->size = (num_pages * page_size);
bank->num_sectors = num_pages;
diff --git a/src/flash/nor/tms470.c b/src/flash/nor/tms470.c
index c1681f19..343c43ed 100644
--- a/src/flash/nor/tms470.c
+++ b/src/flash/nor/tms470.c
@@ -139,6 +139,12 @@ static int tms470_read_part_info(struct flash_bank *bank)
rom_flash = (device_ident_reg >> 10) & 1;
part_number = (device_ident_reg >> 3) & 0x7f;
+ if (bank->sectors)
+ {
+ free(bank->sectors);
+ bank->sectors = NULL;
+ }
+
/*
* If the part number is known, determine if the flash bank is valid
* based on the base address being within the known flash bank