]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/mtd/ubi/scan.c
Merge branch 'master' of git://git.infradead.org/~dedekind/ubi-2.6
[net-next-2.6.git] / drivers / mtd / ubi / scan.c
index 44d87e8158c64f68af6b88915f38ec3256afeb4b..c7b0afc9d2808e13b64ce2fae7d6755b2c99041e 100644 (file)
@@ -1311,11 +1311,10 @@ static int paranoid_check_si(struct ubi_device *ubi, struct ubi_scan_info *si)
         * Make sure that all the physical eraseblocks are in one of the lists
         * or trees.
         */
-       buf = kmalloc(ubi->peb_count, GFP_KERNEL);
+       buf = kzalloc(ubi->peb_count, GFP_KERNEL);
        if (!buf)
                return -ENOMEM;
 
-       memset(buf, 1, ubi->peb_count);
        for (pnum = 0; pnum < ubi->peb_count; pnum++) {
                err = ubi_io_is_bad(ubi, pnum);
                if (err < 0) {
@@ -1323,28 +1322,28 @@ static int paranoid_check_si(struct ubi_device *ubi, struct ubi_scan_info *si)
                        return err;
                }
                else if (err)
-                       buf[pnum] = 0;
+                       buf[pnum] = 1;
        }
 
        ubi_rb_for_each_entry(rb1, sv, &si->volumes, rb)
                ubi_rb_for_each_entry(rb2, seb, &sv->root, u.rb)
-                       buf[seb->pnum] = 0;
+                       buf[seb->pnum] = 1;
 
        list_for_each_entry(seb, &si->free, u.list)
-               buf[seb->pnum] = 0;
+               buf[seb->pnum] = 1;
 
        list_for_each_entry(seb, &si->corr, u.list)
-               buf[seb->pnum] = 0;
+               buf[seb->pnum] = 1;
 
        list_for_each_entry(seb, &si->erase, u.list)
-               buf[seb->pnum] = 0;
+               buf[seb->pnum] = 1;
 
        list_for_each_entry(seb, &si->alien, u.list)
-               buf[seb->pnum] = 0;
+               buf[seb->pnum] = 1;
 
        err = 0;
        for (pnum = 0; pnum < ubi->peb_count; pnum++)
-               if (buf[pnum]) {
+               if (!buf[pnum]) {
                        ubi_err("PEB %d is not referred", pnum);
                        err = 1;
                }