Skip to content

Commit bb4a098

Browse files
dedekindDavid Woodhouse
authored andcommitted
mtdoops: clean-up new MTD API usage
Let's remove useless 'mtd_can_have_bb()' function invocations. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
1 parent 7918687 commit bb4a098

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

‎drivers/mtd/mtdoops.c‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ static void mtdoops_workfunc_erase(struct work_struct *work)
169169
cxt->nextpage = 0;
170170
}
171171

172-
while (mtd_can_have_bb(mtd)) {
172+
while (1) {
173173
ret = mtd_block_isbad(mtd, cxt->nextpage * record_size);
174174
if (!ret)
175175
break;
@@ -199,9 +199,9 @@ static void mtdoops_workfunc_erase(struct work_struct *work)
199199
return;
200200
}
201201

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

259259
for (page = 0; page < cxt->oops_pages; page++) {
260-
if (mtd_can_have_bb(mtd) &&
261-
mtd_block_isbad(mtd, page * record_size))
260+
if (mtd_block_isbad(mtd, page * record_size))
262261
continue;
263262
/* Assume the page is used */
264263
mark_page_used(cxt, page);

0 commit comments

Comments
 (0)