diff options
author | Kiyoshi Ueda <k-ueda@ct.jp.nec.com> | 2008-10-21 12:45:08 -0400 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2008-10-21 12:45:08 -0400 |
commit | 51157b4ab47e1376c2b93cb854b14b637efeaff2 (patch) | |
tree | 76889af489b15aaf8c75d457f29d36336ca0a0a6 /drivers/md/dm.c | |
parent | f431d9666fd6e69fbaf305cebc7278d1428950c2 (diff) |
dm: tidy local_init
This patch tidies local_init() in preparation for request-based dm.
No functional change.
Signed-off-by: Kiyoshi Ueda <k-ueda@ct.jp.nec.com>
Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm.c')
-rw-r--r-- | drivers/md/dm.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 6938bfeb5e2..d1d0cd0f575 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -150,40 +150,40 @@ static struct kmem_cache *_tio_cache; | |||
150 | 150 | ||
151 | static int __init local_init(void) | 151 | static int __init local_init(void) |
152 | { | 152 | { |
153 | int r; | 153 | int r = -ENOMEM; |
154 | 154 | ||
155 | /* allocate a slab for the dm_ios */ | 155 | /* allocate a slab for the dm_ios */ |
156 | _io_cache = KMEM_CACHE(dm_io, 0); | 156 | _io_cache = KMEM_CACHE(dm_io, 0); |
157 | if (!_io_cache) | 157 | if (!_io_cache) |
158 | return -ENOMEM; | 158 | return r; |
159 | 159 | ||
160 | /* allocate a slab for the target ios */ | 160 | /* allocate a slab for the target ios */ |
161 | _tio_cache = KMEM_CACHE(dm_target_io, 0); | 161 | _tio_cache = KMEM_CACHE(dm_target_io, 0); |
162 | if (!_tio_cache) { | 162 | if (!_tio_cache) |
163 | kmem_cache_destroy(_io_cache); | 163 | goto out_free_io_cache; |
164 | return -ENOMEM; | ||
165 | } | ||
166 | 164 | ||
167 | r = dm_uevent_init(); | 165 | r = dm_uevent_init(); |
168 | if (r) { | 166 | if (r) |
169 | kmem_cache_destroy(_tio_cache); | 167 | goto out_free_tio_cache; |
170 | kmem_cache_destroy(_io_cache); | ||
171 | return r; | ||
172 | } | ||
173 | 168 | ||
174 | _major = major; | 169 | _major = major; |
175 | r = register_blkdev(_major, _name); | 170 | r = register_blkdev(_major, _name); |
176 | if (r < 0) { | 171 | if (r < 0) |
177 | kmem_cache_destroy(_tio_cache); | 172 | goto out_uevent_exit; |
178 | kmem_cache_destroy(_io_cache); | ||
179 | dm_uevent_exit(); | ||
180 | return r; | ||
181 | } | ||
182 | 173 | ||
183 | if (!_major) | 174 | if (!_major) |
184 | _major = r; | 175 | _major = r; |
185 | 176 | ||
186 | return 0; | 177 | return 0; |
178 | |||
179 | out_uevent_exit: | ||
180 | dm_uevent_exit(); | ||
181 | out_free_tio_cache: | ||
182 | kmem_cache_destroy(_tio_cache); | ||
183 | out_free_io_cache: | ||
184 | kmem_cache_destroy(_io_cache); | ||
185 | |||
186 | return r; | ||
187 | } | 187 | } |
188 | 188 | ||
189 | static void local_exit(void) | 189 | static void local_exit(void) |