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>
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);