flash: fix stm32 flash driver typo's
[fw/openocd] / src / flash / nor / stm32f1x.c
index 938785ef1b5826475f95718dfb5d815ffc1247e9..2a6604dc2a42833e0724adf96f89610dbfb46839 100644 (file)
@@ -902,6 +902,11 @@ static int stm32x_probe(struct flash_bank *bank)
                flash_size_in_kb = 0xffff;
        }
 
+       /* some variants read 0 for flash size register
+        * use a max flash size as a default */
+       if (flash_size_in_kb == 0)
+               flash_size_in_kb = 0xffff;
+
        if ((device_id & 0xfff) == 0x410) {
                /* medium density - we have 1k pages
                 * 4 pages for a protection area */
@@ -958,7 +963,7 @@ static int stm32x_probe(struct flash_bank *bank)
 
                /* check for early silicon */
                if (flash_size_in_kb == 0xffff) {
-                       /* number of sectors may be incorrrect on early silicon */
+                       /* number of sectors may be incorrect on early silicon */
                        LOG_WARNING("STM32 flash size failed, probe inaccurate - assuming 128k flash");
                        flash_size_in_kb = 128;
                }
@@ -981,7 +986,7 @@ static int stm32x_probe(struct flash_bank *bank)
 
                /* check for early silicon */
                if (flash_size_in_kb == 0xffff) {
-                       /* number of sectors may be incorrrect on early silicon */
+                       /* number of sectors may be incorrect on early silicon */
                        LOG_WARNING("STM32 flash size failed, probe inaccurate - assuming 128k flash");
                        flash_size_in_kb = 128;
                }
@@ -994,7 +999,7 @@ static int stm32x_probe(struct flash_bank *bank)
 
                /* check for early silicon */
                if (flash_size_in_kb == 0xffff) {
-                       /* number of sectors may be incorrrect on early silicon */
+                       /* number of sectors may be incorrect on early silicon */
                        LOG_WARNING("STM32 flash size failed, probe inaccurate - assuming 1024k flash");
                        flash_size_in_kb = 1024;
                }