This is an automated email from Gerrit.

?yvind Harboe ([email protected]) just uploaded a new patch set to Gerrit, 
which you can find at http://openocd.zylin.com/187

-- gerrit

commit a38ef9f38a3eda257fccb74df5835c4fc46f3040
Author: Øyvind Harboe <[email protected]>
Date:   Tue Nov 8 21:45:47 2011 +0100

    stm32f1x: add more asserts
    
    this at least checks the post conditions after convoluted code.
    
    Change-Id: Idfa8cbedce5288d8bae5743687949f141dfb07b2
    Signed-off-by: Øyvind Harboe <[email protected]>

diff --git a/src/flash/nor/stm32f1x.c b/src/flash/nor/stm32f1x.c
index 6c419e9..0678ce3 100644
--- a/src/flash/nor/stm32f1x.c
+++ b/src/flash/nor/stm32f1x.c
@@ -1107,9 +1107,15 @@ static int stm32x_probe(struct flash_bank *bank)
 
        LOG_INFO("flash size = %dkbytes", num_pages);
 
+       /* did we assign # of pages? */
+       assert(num_pages != 0xffff);
+
        /* calculate numbers of pages */
        num_pages /= (page_size / 1024);
 
+       /* check that calculation result makes sense */
+       assert(num_pages > 0);
+
        if (bank->sectors)
        {
                free(bank->sectors);

-- 

------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Openocd-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to