]> Pileus Git - ~andy/linux/blobdiff - drivers/mtd/mtdoops.c
Merge tag 'v3.6-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux
[~andy/linux] / drivers / mtd / mtdoops.c
index 551e316e4454d99f9b552a2924bea045784c7a8c..788f00be8d07d9a7724e1ab1e771d8a33fde75bd 100644 (file)
@@ -169,14 +169,7 @@ static void mtdoops_workfunc_erase(struct work_struct *work)
                        cxt->nextpage = 0;
        }
 
-       while (1) {
-               ret = mtd_block_isbad(mtd, cxt->nextpage * record_size);
-               if (!ret)
-                       break;
-               if (ret < 0) {
-                       printk(KERN_ERR "mtdoops: block_isbad failed, aborting\n");
-                       return;
-               }
+       while ((ret = mtd_block_isbad(mtd, cxt->nextpage * record_size)) > 0) {
 badblock:
                printk(KERN_WARNING "mtdoops: bad block at %08lx\n",
                       cxt->nextpage * record_size);
@@ -190,6 +183,11 @@ badblock:
                }
        }
 
+       if (ret < 0) {
+               printk(KERN_ERR "mtdoops: mtd_block_isbad failed, aborting\n");
+               return;
+       }
+
        for (j = 0, ret = -1; (j < 3) && (ret < 0); j++)
                ret = mtdoops_erase_block(cxt, cxt->nextpage * record_size);