diff options
Diffstat (limited to 'drivers/mtd/ubi/wl.c')
-rw-r--r-- | drivers/mtd/ubi/wl.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c index 600c7229d5cf..f64ddabd4ac8 100644 --- a/drivers/mtd/ubi/wl.c +++ b/drivers/mtd/ubi/wl.c | |||
@@ -464,7 +464,7 @@ retry: | |||
464 | ubi->peb_size - ubi->vid_hdr_aloffset); | 464 | ubi->peb_size - ubi->vid_hdr_aloffset); |
465 | if (err) { | 465 | if (err) { |
466 | ubi_err("new PEB %d does not contain all 0xFF bytes", e->pnum); | 466 | ubi_err("new PEB %d does not contain all 0xFF bytes", e->pnum); |
467 | return err > 0 ? -EINVAL : err; | 467 | return err; |
468 | } | 468 | } |
469 | 469 | ||
470 | return e->pnum; | 470 | return e->pnum; |
@@ -513,7 +513,7 @@ static int sync_erase(struct ubi_device *ubi, struct ubi_wl_entry *e, | |||
513 | dbg_wl("erase PEB %d, old EC %llu", e->pnum, ec); | 513 | dbg_wl("erase PEB %d, old EC %llu", e->pnum, ec); |
514 | 514 | ||
515 | err = paranoid_check_ec(ubi, e->pnum, e->ec); | 515 | err = paranoid_check_ec(ubi, e->pnum, e->ec); |
516 | if (err > 0) | 516 | if (err) |
517 | return -EINVAL; | 517 | return -EINVAL; |
518 | 518 | ||
519 | ec_hdr = kzalloc(ubi->ec_hdr_alsize, GFP_NOFS); | 519 | ec_hdr = kzalloc(ubi->ec_hdr_alsize, GFP_NOFS); |
@@ -1572,8 +1572,7 @@ void ubi_wl_close(struct ubi_device *ubi) | |||
1572 | * @ec: the erase counter to check | 1572 | * @ec: the erase counter to check |
1573 | * | 1573 | * |
1574 | * This function returns zero if the erase counter of physical eraseblock @pnum | 1574 | * This function returns zero if the erase counter of physical eraseblock @pnum |
1575 | * is equivalent to @ec, %1 if not, and a negative error code if an error | 1575 | * is equivalent to @ec, and a negative error code if not or if an error occurred. |
1576 | * occurred. | ||
1577 | */ | 1576 | */ |
1578 | static int paranoid_check_ec(struct ubi_device *ubi, int pnum, int ec) | 1577 | static int paranoid_check_ec(struct ubi_device *ubi, int pnum, int ec) |
1579 | { | 1578 | { |
@@ -1611,8 +1610,8 @@ out_free: | |||
1611 | * @e: the wear-leveling entry to check | 1610 | * @e: the wear-leveling entry to check |
1612 | * @root: the root of the tree | 1611 | * @root: the root of the tree |
1613 | * | 1612 | * |
1614 | * This function returns zero if @e is in the @root RB-tree and %1 if it is | 1613 | * This function returns zero if @e is in the @root RB-tree and %-EINVAL if it |
1615 | * not. | 1614 | * is not. |
1616 | */ | 1615 | */ |
1617 | static int paranoid_check_in_wl_tree(struct ubi_wl_entry *e, | 1616 | static int paranoid_check_in_wl_tree(struct ubi_wl_entry *e, |
1618 | struct rb_root *root) | 1617 | struct rb_root *root) |
@@ -1623,7 +1622,7 @@ static int paranoid_check_in_wl_tree(struct ubi_wl_entry *e, | |||
1623 | ubi_err("paranoid check failed for PEB %d, EC %d, RB-tree %p ", | 1622 | ubi_err("paranoid check failed for PEB %d, EC %d, RB-tree %p ", |
1624 | e->pnum, e->ec, root); | 1623 | e->pnum, e->ec, root); |
1625 | ubi_dbg_dump_stack(); | 1624 | ubi_dbg_dump_stack(); |
1626 | return 1; | 1625 | return -EINVAL; |
1627 | } | 1626 | } |
1628 | 1627 | ||
1629 | /** | 1628 | /** |
@@ -1632,7 +1631,7 @@ static int paranoid_check_in_wl_tree(struct ubi_wl_entry *e, | |||
1632 | * @ubi: UBI device description object | 1631 | * @ubi: UBI device description object |
1633 | * @e: the wear-leveling entry to check | 1632 | * @e: the wear-leveling entry to check |
1634 | * | 1633 | * |
1635 | * This function returns zero if @e is in @ubi->pq and %1 if it is not. | 1634 | * This function returns zero if @e is in @ubi->pq and %-EINVAL if it is not. |
1636 | */ | 1635 | */ |
1637 | static int paranoid_check_in_pq(struct ubi_device *ubi, struct ubi_wl_entry *e) | 1636 | static int paranoid_check_in_pq(struct ubi_device *ubi, struct ubi_wl_entry *e) |
1638 | { | 1637 | { |
@@ -1647,6 +1646,6 @@ static int paranoid_check_in_pq(struct ubi_device *ubi, struct ubi_wl_entry *e) | |||
1647 | ubi_err("paranoid check failed for PEB %d, EC %d, Protect queue", | 1646 | ubi_err("paranoid check failed for PEB %d, EC %d, Protect queue", |
1648 | e->pnum, e->ec); | 1647 | e->pnum, e->ec); |
1649 | ubi_dbg_dump_stack(); | 1648 | ubi_dbg_dump_stack(); |
1650 | return 1; | 1649 | return -EINVAL; |
1651 | } | 1650 | } |
1652 | #endif /* CONFIG_MTD_UBI_DEBUG_PARANOID */ | 1651 | #endif /* CONFIG_MTD_UBI_DEBUG_PARANOID */ |