]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Use vzalloc() instead of vmalloc()+memset().
authorJoe Perches <joe@perches.com>
Mon, 25 Jul 2011 00:49:52 +0000 (10:49 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Mon, 25 Jul 2011 00:49:52 +0000 (10:49 +1000)
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
drivers/md/dm-log.c
drivers/md/dm-snap-persistent.c
drivers/md/dm-table.c

index 2ef7e6ef5a7cbc15250d87ad85a4901dacb9efa4..b298e5afe53bb66a637e7baf8fbcc3fe07fdfa21 100644 (file)
@@ -486,7 +486,7 @@ static int create_log_context(struct dm_dirty_log *log, struct dm_target *ti,
        memset(lc->sync_bits, (sync == NOSYNC) ? -1 : 0, bitset_size);
        lc->sync_count = (sync == NOSYNC) ? region_count : 0;
 
-       lc->recovering_bits = vmalloc(bitset_size);
+       lc->recovering_bits = vzalloc(bitset_size);
        if (!lc->recovering_bits) {
                DMWARN("couldn't allocate sync bitset");
                vfree(lc->sync_bits);
@@ -498,7 +498,6 @@ static int create_log_context(struct dm_dirty_log *log, struct dm_target *ti,
                kfree(lc);
                return -ENOMEM;
        }
-       memset(lc->recovering_bits, 0, bitset_size);
        lc->sync_search = 0;
        log->context = lc;
 
index e4ecadf0548a72c8cca30b169c2feb80a06719b5..9ebc08a4346a71f051f66ee5e26251814290d311 100644 (file)
@@ -169,10 +169,9 @@ static int alloc_area(struct pstore *ps)
        if (!ps->area)
                goto err_area;
 
-       ps->zero_area = vmalloc(len);
+       ps->zero_area = vzalloc(len);
        if (!ps->zero_area)
                goto err_zero_area;
-       memset(ps->zero_area, 0, len);
 
        ps->header_area = vmalloc(len);
        if (!ps->header_area)
index aaf764819459206c39647ab46773eb5675ea03dc..44bf4913150d6abfb09b262acc8b3c2b5950ee2d 100644 (file)
@@ -153,9 +153,7 @@ void *dm_vcalloc(unsigned long nmemb, unsigned long elem_size)
                return NULL;
 
        size = nmemb * elem_size;
-       addr = vmalloc(size);
-       if (addr)
-               memset(addr, 0, size);
+       addr = vzalloc(size);
 
        return addr;
 }