diff options
author | Wyatt Banks <wyatt@banksresearch.com> | 2007-11-19 10:22:33 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:03:58 -0400 |
commit | 2f4cbe6442d3be7b5e4cf1607a5ab33995fe2d25 (patch) | |
tree | a2c1554296d2d8252fb1748dd06c589572e5be54 /fs/btrfs/extent_map.c | |
parent | 3acd7ee876c508973eb4722de5b00b3dff4c7372 (diff) | |
download | op-kernel-dev-2f4cbe6442d3be7b5e4cf1607a5ab33995fe2d25.zip op-kernel-dev-2f4cbe6442d3be7b5e4cf1607a5ab33995fe2d25.tar.gz |
Btrfs: Return value checking in module init
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent_map.c')
-rw-r--r-- | fs/btrfs/extent_map.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c index b3ff63c..f91f28e 100644 --- a/fs/btrfs/extent_map.c +++ b/fs/btrfs/extent_map.c @@ -42,18 +42,30 @@ struct extent_page_data { struct extent_map_tree *tree; get_extent_t *get_extent; }; - -void __init extent_map_init(void) +int __init extent_map_init(void) { extent_map_cache = btrfs_cache_create("extent_map", sizeof(struct extent_map), 0, NULL); + if (!extent_map_cache) + return -ENOMEM; extent_state_cache = btrfs_cache_create("extent_state", sizeof(struct extent_state), 0, NULL); + if (!extent_state_cache) + goto free_map_cache; extent_buffer_cache = btrfs_cache_create("extent_buffers", sizeof(struct extent_buffer), 0, NULL); + if (!extent_buffer_cache) + goto free_state_cache; + return 0; + +free_state_cache: + kmem_cache_destroy(extent_state_cache); +free_map_cache: + kmem_cache_destroy(extent_map_cache); + return -ENOMEM; } void __exit extent_map_exit(void) |