Merge ../linux-2.6-watchdog-mm
[pandora-kernel.git] / fs / jffs2 / scan.c
index 2bfdc33..3af746e 100644 (file)
@@ -128,17 +128,19 @@ int jffs2_scan_medium(struct jffs2_sb_info *c)
        }
 
        if (jffs2_sum_active()) {
-               s = kmalloc(sizeof(struct jffs2_summary), GFP_KERNEL);
+               s = kzalloc(sizeof(struct jffs2_summary), GFP_KERNEL);
                if (!s) {
+                       kfree(flashbuf);
                        JFFS2_WARNING("Can't allocate memory for summary\n");
                        return -ENOMEM;
                }
-               memset(s, 0, sizeof(struct jffs2_summary));
        }
 
        for (i=0; i<c->nr_blocks; i++) {
                struct jffs2_eraseblock *jeb = &c->blocks[i];
 
+               cond_resched();
+
                /* reset summary info for next eraseblock scan */
                jffs2_sum_reset_collected(s);
 
@@ -274,8 +276,8 @@ int jffs2_scan_medium(struct jffs2_sb_info *c)
        return ret;
 }
 
-int jffs2_fill_scan_buf (struct jffs2_sb_info *c, void *buf,
-                               uint32_t ofs, uint32_t len)
+static int jffs2_fill_scan_buf(struct jffs2_sb_info *c, void *buf,
+                              uint32_t ofs, uint32_t len)
 {
        int ret;
        size_t retlen;