From 2f46c8f9e562a88c9dbbb1d93c21d6f08c106816 Mon Sep 17 00:00:00 2001 From: Michael Grzeschik Date: Wed, 12 Feb 2014 12:37:15 +0100 Subject: state: fix state handling for devices without needed erase Signed-off-by: Michael Grzeschik Signed-off-by: Sascha Hauer --- src/state.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/state.c b/src/state.c index c8fbc59..63f561f 100644 --- a/src/state.c +++ b/src/state.c @@ -1067,7 +1067,8 @@ int state_backend_raw_file(struct state *state, const char *path, off_t offset, if (!ret) { if (!size) size = meminfo.size; - backend_raw->need_erase = 1; + if (!(meminfo.flags & MTD_NO_ERASE)) + backend_raw->need_erase = 1; backend_raw->step = ALIGN(backend_raw->size_full, meminfo.erasesize); if (verbose) fprintf(stderr, "%s is a mtd of size %d, adjust stepsize to %ld\n", -- cgit v1.2.3