This patch makes sure that a virtual erase block is always
composed of a postivie number of erase blocks (i.e. 1 or more)
and enforces the block alignment to be a power of two as
suggested by the help text and assumed throughout the program.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
errmsg_die("Can't specify negative device offset with option"
" -s: %lld", mtdoffset);
- if (blockalign < 0)
- errmsg_die("Can't specify negative blockalign with option -b:"
- " %d", blockalign);
+ if (blockalign <= 0)
+ errmsg_die("Can't specify negative or zero blockalign with "
+ "option -b: %d", blockalign);
+
+ if (!is_power_of_2(blockalign))
+ errmsg_die("Can't specify a non-power-of-two blockalign with "
+ "option -b: %d", blockalign);
if (autoplace && noecc)
errmsg_die("Autoplacement and no-ECC are mutually exclusive");