stm32f1x: add more asserts
this at least checks the post conditions after convoluted code. Change-Id: Idfa8cbedce5288d8bae5743687949f141dfb07b2 Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com> Reviewed-on: http://openocd.zylin.com/187 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
This commit is contained in:
parent
9450da873c
commit
287ba1888b
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue