Skip to content

Commit

Permalink
mtdoops: clean-up new MTD API usage
Browse files Browse the repository at this point in the history
Let's remove useless 'mtd_can_have_bb()' function invocations.

Signed-off-by: Artem Bityutskiy <[email protected]>
Signed-off-by: David Woodhouse <[email protected]>
  • Loading branch information
dedekind authored and David Woodhouse committed Mar 26, 2012
1 parent 7918687 commit bb4a098
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions drivers/mtd/mtdoops.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ static void mtdoops_workfunc_erase(struct work_struct *work)
cxt->nextpage = 0;
}

while (mtd_can_have_bb(mtd)) {
while (1) {
ret = mtd_block_isbad(mtd, cxt->nextpage * record_size);
if (!ret)
break;
Expand Down Expand Up @@ -199,9 +199,9 @@ static void mtdoops_workfunc_erase(struct work_struct *work)
return;
}

if (mtd_can_have_bb(mtd) && ret == -EIO) {
if (ret == -EIO) {
ret = mtd_block_markbad(mtd, cxt->nextpage * record_size);
if (ret < 0) {
if (ret < 0 && ret != -EOPNOTSUPP) {
printk(KERN_ERR "mtdoops: block_markbad failed, aborting\n");
return;
}
Expand Down Expand Up @@ -257,8 +257,7 @@ static void find_next_position(struct mtdoops_context *cxt)
size_t retlen;

for (page = 0; page < cxt->oops_pages; page++) {
if (mtd_can_have_bb(mtd) &&
mtd_block_isbad(mtd, page * record_size))
if (mtd_block_isbad(mtd, page * record_size))
continue;
/* Assume the page is used */
mark_page_used(cxt, page);
Expand Down

0 comments on commit bb4a098

Please sign in to comment.