summaryrefslogtreecommitdiffstats
path: root/common/ubiformat.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/ubiformat.c')
-rw-r--r--common/ubiformat.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/common/ubiformat.c b/common/ubiformat.c
index 72b9b6f2eb..d8399ad9d6 100644
--- a/common/ubiformat.c
+++ b/common/ubiformat.c
@@ -1,16 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (C) 2008 Nokia Corporation
* Copyright (C) 2012 Wolfram Sang, Pengutronix
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
- * the GNU General Public License for more details.
*/
/*
@@ -20,7 +11,7 @@
*/
/*
- * Maximum amount of consequtive eraseblocks which are considered as normal by
+ * Maximum amount of consecutive eraseblocks which are considered as normal by
* this utility. Otherwise it is assume that something is wrong with the flash
* or the driver, and eraseblocks are stopped being marked as bad.
*/
@@ -453,7 +444,7 @@ static int format(struct ubiformat_args *args, struct mtd_info *mtd,
}
if (!args->quiet && !args->verbose)
- printf("\n");
+ printf("\rubiformat: formatted all eraseblocks -- 100 %% complete\n");
if (!novtbl) {
if (eb1 == -1 || eb2 == -1) {
@@ -754,6 +745,7 @@ int ubiformat_write(struct mtd_info *mtd, const void *buf, size_t count,
while (count) {
size_t now = mtd->erasesize - offset_in_peb;
+ int new_len;
if (now > count)
now = count;
@@ -789,7 +781,8 @@ int ubiformat_write(struct mtd_info *mtd, const void *buf, size_t count,
}
}
- ret = mtd_peb_write(mtd, buf, peb, offset_in_peb, now);
+ new_len = drop_ffs(mtd, buf, now);
+ ret = mtd_peb_write(mtd, buf, peb, offset_in_peb, new_len);
if (ret < 0)
return ret;