diff options
Diffstat (limited to 'drivers/mtd/ubi/upd.c')
-rw-r--r-- | drivers/mtd/ubi/upd.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/mtd/ubi/upd.c b/drivers/mtd/ubi/upd.c index 74fdc40c8627..425bf5a3edd4 100644 --- a/drivers/mtd/ubi/upd.c +++ b/drivers/mtd/ubi/upd.c | |||
@@ -147,12 +147,15 @@ int ubi_start_update(struct ubi_device *ubi, struct ubi_volume *vol, | |||
147 | } | 147 | } |
148 | 148 | ||
149 | if (bytes == 0) { | 149 | if (bytes == 0) { |
150 | err = ubi_wl_flush(ubi); | ||
151 | if (err) | ||
152 | return err; | ||
153 | |||
150 | err = clear_update_marker(ubi, vol, 0); | 154 | err = clear_update_marker(ubi, vol, 0); |
151 | if (err) | 155 | if (err) |
152 | return err; | 156 | return err; |
153 | err = ubi_wl_flush(ubi); | 157 | vol->updating = 0; |
154 | if (!err) | 158 | return 0; |
155 | vol->updating = 0; | ||
156 | } | 159 | } |
157 | 160 | ||
158 | vol->upd_buf = vmalloc(ubi->leb_size); | 161 | vol->upd_buf = vmalloc(ubi->leb_size); |
@@ -362,16 +365,16 @@ int ubi_more_update_data(struct ubi_device *ubi, struct ubi_volume *vol, | |||
362 | 365 | ||
363 | ubi_assert(vol->upd_received <= vol->upd_bytes); | 366 | ubi_assert(vol->upd_received <= vol->upd_bytes); |
364 | if (vol->upd_received == vol->upd_bytes) { | 367 | if (vol->upd_received == vol->upd_bytes) { |
368 | err = ubi_wl_flush(ubi); | ||
369 | if (err) | ||
370 | return err; | ||
365 | /* The update is finished, clear the update marker */ | 371 | /* The update is finished, clear the update marker */ |
366 | err = clear_update_marker(ubi, vol, vol->upd_bytes); | 372 | err = clear_update_marker(ubi, vol, vol->upd_bytes); |
367 | if (err) | 373 | if (err) |
368 | return err; | 374 | return err; |
369 | err = ubi_wl_flush(ubi); | 375 | vol->updating = 0; |
370 | if (err == 0) { | 376 | err = to_write; |
371 | vol->updating = 0; | 377 | vfree(vol->upd_buf); |
372 | err = to_write; | ||
373 | vfree(vol->upd_buf); | ||
374 | } | ||
375 | } | 378 | } |
376 | 379 | ||
377 | return err; | 380 | return err; |