summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--commands/ubiformat.c2
-rw-r--r--common/ubiformat.c6
2 files changed, 6 insertions, 2 deletions
diff --git a/commands/ubiformat.c b/commands/ubiformat.c
index f4982c8..a88672d 100644
--- a/commands/ubiformat.c
+++ b/commands/ubiformat.c
@@ -60,8 +60,6 @@ static int parse_opt(int argc, char *argv[], struct ubiformat_args *args,
{
srand(get_time_ns());
memset(args, 0, sizeof(*args));
- args->ubi_ver = 1;
- args->image_seq = rand();
while (1) {
int key;
diff --git a/common/ubiformat.c b/common/ubiformat.c
index e4f569b..aaa1f5d 100644
--- a/common/ubiformat.c
+++ b/common/ubiformat.c
@@ -451,6 +451,12 @@ int ubiformat(struct mtd_info *mtd, struct ubiformat_args *args)
struct ubi_scan_info *si;
int ubi_num;
+ if (!args->ubi_ver)
+ args->ubi_ver = 1;
+
+ if (!args->image_seq)
+ args->image_seq = rand();
+
if (!is_power_of_2(mtd->writesize)) {
errmsg("min. I/O size is %d, but should be power of 2",
mtd->writesize);