diff options
author | Dmitry Monakhov <dmonakhov@openvz.org> | 2007-10-19 17:38:51 -0400 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2007-10-19 21:01:07 -0400 |
commit | 094262db9e4c615e0db7a7b924d244b7a6c186b0 (patch) | |
tree | c8c79edd122d9b32b1cd61c9c7070e14d3656a67 /drivers/md | |
parent | 6f3c3f0afa50782dc1742c968646c491657d255a (diff) |
dm: use kzalloc
Convert kmalloc() + memset() to kzalloc().
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/dm-emc.c | 6 | ||||
-rw-r--r-- | drivers/md/dm-hw-handler.c | 6 | ||||
-rw-r--r-- | drivers/md/dm-path-selector.c | 6 | ||||
-rw-r--r-- | drivers/md/dm-table.c | 3 | ||||
-rw-r--r-- | drivers/md/dm-target.c | 6 |
5 files changed, 9 insertions, 18 deletions
diff --git a/drivers/md/dm-emc.c b/drivers/md/dm-emc.c index 342517261ece..ed28fe2072f0 100644 --- a/drivers/md/dm-emc.c +++ b/drivers/md/dm-emc.c | |||
@@ -211,12 +211,10 @@ fail_path: | |||
211 | 211 | ||
212 | static struct emc_handler *alloc_emc_handler(void) | 212 | static struct emc_handler *alloc_emc_handler(void) |
213 | { | 213 | { |
214 | struct emc_handler *h = kmalloc(sizeof(*h), GFP_KERNEL); | 214 | struct emc_handler *h = kzalloc(sizeof(*h), GFP_KERNEL); |
215 | 215 | ||
216 | if (h) { | 216 | if (h) |
217 | memset(h, 0, sizeof(*h)); | ||
218 | spin_lock_init(&h->lock); | 217 | spin_lock_init(&h->lock); |
219 | } | ||
220 | 218 | ||
221 | return h; | 219 | return h; |
222 | } | 220 | } |
diff --git a/drivers/md/dm-hw-handler.c b/drivers/md/dm-hw-handler.c index baafaaba4d4b..2ee84d8aa0bf 100644 --- a/drivers/md/dm-hw-handler.c +++ b/drivers/md/dm-hw-handler.c | |||
@@ -91,12 +91,10 @@ void dm_put_hw_handler(struct hw_handler_type *hwht) | |||
91 | 91 | ||
92 | static struct hwh_internal *_alloc_hw_handler(struct hw_handler_type *hwht) | 92 | static struct hwh_internal *_alloc_hw_handler(struct hw_handler_type *hwht) |
93 | { | 93 | { |
94 | struct hwh_internal *hwhi = kmalloc(sizeof(*hwhi), GFP_KERNEL); | 94 | struct hwh_internal *hwhi = kzalloc(sizeof(*hwhi), GFP_KERNEL); |
95 | 95 | ||
96 | if (hwhi) { | 96 | if (hwhi) |
97 | memset(hwhi, 0, sizeof(*hwhi)); | ||
98 | hwhi->hwht = *hwht; | 97 | hwhi->hwht = *hwht; |
99 | } | ||
100 | 98 | ||
101 | return hwhi; | 99 | return hwhi; |
102 | } | 100 | } |
diff --git a/drivers/md/dm-path-selector.c b/drivers/md/dm-path-selector.c index f10a0c89b3f4..ca1bb636a3e4 100644 --- a/drivers/md/dm-path-selector.c +++ b/drivers/md/dm-path-selector.c | |||
@@ -94,12 +94,10 @@ out: | |||
94 | 94 | ||
95 | static struct ps_internal *_alloc_path_selector(struct path_selector_type *pst) | 95 | static struct ps_internal *_alloc_path_selector(struct path_selector_type *pst) |
96 | { | 96 | { |
97 | struct ps_internal *psi = kmalloc(sizeof(*psi), GFP_KERNEL); | 97 | struct ps_internal *psi = kzalloc(sizeof(*psi), GFP_KERNEL); |
98 | 98 | ||
99 | if (psi) { | 99 | if (psi) |
100 | memset(psi, 0, sizeof(*psi)); | ||
101 | psi->pst = *pst; | 100 | psi->pst = *pst; |
102 | } | ||
103 | 101 | ||
104 | return psi; | 102 | return psi; |
105 | } | 103 | } |
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index fbe477bb2c68..8939e6105088 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c | |||
@@ -213,12 +213,11 @@ static int alloc_targets(struct dm_table *t, unsigned int num) | |||
213 | int dm_table_create(struct dm_table **result, int mode, | 213 | int dm_table_create(struct dm_table **result, int mode, |
214 | unsigned num_targets, struct mapped_device *md) | 214 | unsigned num_targets, struct mapped_device *md) |
215 | { | 215 | { |
216 | struct dm_table *t = kmalloc(sizeof(*t), GFP_KERNEL); | 216 | struct dm_table *t = kzalloc(sizeof(*t), GFP_KERNEL); |
217 | 217 | ||
218 | if (!t) | 218 | if (!t) |
219 | return -ENOMEM; | 219 | return -ENOMEM; |
220 | 220 | ||
221 | memset(t, 0, sizeof(*t)); | ||
222 | INIT_LIST_HEAD(&t->devices); | 221 | INIT_LIST_HEAD(&t->devices); |
223 | atomic_set(&t->holders, 1); | 222 | atomic_set(&t->holders, 1); |
224 | 223 | ||
diff --git a/drivers/md/dm-target.c b/drivers/md/dm-target.c index 477a041a41cf..835cf95b857f 100644 --- a/drivers/md/dm-target.c +++ b/drivers/md/dm-target.c | |||
@@ -88,12 +88,10 @@ void dm_put_target_type(struct target_type *t) | |||
88 | 88 | ||
89 | static struct tt_internal *alloc_target(struct target_type *t) | 89 | static struct tt_internal *alloc_target(struct target_type *t) |
90 | { | 90 | { |
91 | struct tt_internal *ti = kmalloc(sizeof(*ti), GFP_KERNEL); | 91 | struct tt_internal *ti = kzalloc(sizeof(*ti), GFP_KERNEL); |
92 | 92 | ||
93 | if (ti) { | 93 | if (ti) |
94 | memset(ti, 0, sizeof(*ti)); | ||
95 | ti->tt = *t; | 94 | ti->tt = *t; |
96 | } | ||
97 | 95 | ||
98 | return ti; | 96 | return ti; |
99 | } | 97 | } |