Commit 094262db authored by Dmitry Monakhov's avatar Dmitry Monakhov Committed by Alasdair G Kergon

dm: use kzalloc

Convert kmalloc() + memset() to kzalloc().
Signed-off-by: default avatarDmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
parent 6f3c3f0a
...@@ -211,12 +211,10 @@ static void emc_pg_init(struct hw_handler *hwh, unsigned bypassed, ...@@ -211,12 +211,10 @@ static void emc_pg_init(struct hw_handler *hwh, unsigned bypassed,
static struct emc_handler *alloc_emc_handler(void) static struct emc_handler *alloc_emc_handler(void)
{ {
struct emc_handler *h = kmalloc(sizeof(*h), GFP_KERNEL); struct emc_handler *h = kzalloc(sizeof(*h), GFP_KERNEL);
if (h) { if (h)
memset(h, 0, sizeof(*h));
spin_lock_init(&h->lock); spin_lock_init(&h->lock);
}
return h; return h;
} }
......
...@@ -91,12 +91,10 @@ void dm_put_hw_handler(struct hw_handler_type *hwht) ...@@ -91,12 +91,10 @@ void dm_put_hw_handler(struct hw_handler_type *hwht)
static struct hwh_internal *_alloc_hw_handler(struct hw_handler_type *hwht) static struct hwh_internal *_alloc_hw_handler(struct hw_handler_type *hwht)
{ {
struct hwh_internal *hwhi = kmalloc(sizeof(*hwhi), GFP_KERNEL); struct hwh_internal *hwhi = kzalloc(sizeof(*hwhi), GFP_KERNEL);
if (hwhi) { if (hwhi)
memset(hwhi, 0, sizeof(*hwhi));
hwhi->hwht = *hwht; hwhi->hwht = *hwht;
}
return hwhi; return hwhi;
} }
......
...@@ -94,12 +94,10 @@ void dm_put_path_selector(struct path_selector_type *pst) ...@@ -94,12 +94,10 @@ void dm_put_path_selector(struct path_selector_type *pst)
static struct ps_internal *_alloc_path_selector(struct path_selector_type *pst) static struct ps_internal *_alloc_path_selector(struct path_selector_type *pst)
{ {
struct ps_internal *psi = kmalloc(sizeof(*psi), GFP_KERNEL); struct ps_internal *psi = kzalloc(sizeof(*psi), GFP_KERNEL);
if (psi) { if (psi)
memset(psi, 0, sizeof(*psi));
psi->pst = *pst; psi->pst = *pst;
}
return psi; return psi;
} }
......
...@@ -213,12 +213,11 @@ static int alloc_targets(struct dm_table *t, unsigned int num) ...@@ -213,12 +213,11 @@ static int alloc_targets(struct dm_table *t, unsigned int num)
int dm_table_create(struct dm_table **result, int mode, int dm_table_create(struct dm_table **result, int mode,
unsigned num_targets, struct mapped_device *md) unsigned num_targets, struct mapped_device *md)
{ {
struct dm_table *t = kmalloc(sizeof(*t), GFP_KERNEL); struct dm_table *t = kzalloc(sizeof(*t), GFP_KERNEL);
if (!t) if (!t)
return -ENOMEM; return -ENOMEM;
memset(t, 0, sizeof(*t));
INIT_LIST_HEAD(&t->devices); INIT_LIST_HEAD(&t->devices);
atomic_set(&t->holders, 1); atomic_set(&t->holders, 1);
......
...@@ -88,12 +88,10 @@ void dm_put_target_type(struct target_type *t) ...@@ -88,12 +88,10 @@ void dm_put_target_type(struct target_type *t)
static struct tt_internal *alloc_target(struct target_type *t) static struct tt_internal *alloc_target(struct target_type *t)
{ {
struct tt_internal *ti = kmalloc(sizeof(*ti), GFP_KERNEL); struct tt_internal *ti = kzalloc(sizeof(*ti), GFP_KERNEL);
if (ti) { if (ti)
memset(ti, 0, sizeof(*ti));
ti->tt = *t; ti->tt = *t;
}
return ti; return ti;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment