diff options
Diffstat (limited to 'drivers/mtd/ubi/io.c')
-rw-r--r-- | drivers/mtd/ubi/io.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c index eededf94f5a6..e347cc4388ed 100644 --- a/drivers/mtd/ubi/io.c +++ b/drivers/mtd/ubi/io.c | |||
@@ -344,6 +344,12 @@ static int do_sync_erase(struct ubi_device *ubi, int pnum) | |||
344 | wait_queue_head_t wq; | 344 | wait_queue_head_t wq; |
345 | 345 | ||
346 | dbg_io("erase PEB %d", pnum); | 346 | dbg_io("erase PEB %d", pnum); |
347 | ubi_assert(pnum >= 0 && pnum < ubi->peb_count); | ||
348 | |||
349 | if (ubi->ro_mode) { | ||
350 | ubi_err("read-only mode"); | ||
351 | return -EROFS; | ||
352 | } | ||
347 | 353 | ||
348 | retry: | 354 | retry: |
349 | init_waitqueue_head(&wq); | 355 | init_waitqueue_head(&wq); |
@@ -390,7 +396,7 @@ retry: | |||
390 | if (err) | 396 | if (err) |
391 | return err; | 397 | return err; |
392 | 398 | ||
393 | if (ubi_dbg_is_erase_failure() && !err) { | 399 | if (ubi_dbg_is_erase_failure()) { |
394 | dbg_err("cannot erase PEB %d (emulated)", pnum); | 400 | dbg_err("cannot erase PEB %d (emulated)", pnum); |
395 | return -EIO; | 401 | return -EIO; |
396 | } | 402 | } |