Skip to content

Commit

Permalink
hugetlbfs: return error code when initializing module
Browse files Browse the repository at this point in the history
Return an errno upon failure to create inode kmem cache, and unregister
the FS upon failure to mount.

[[email protected]: remove unneeded test of `error']
Signed-off-by: Hillf Danton <[email protected]>
Acked-by: David Rientjes <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Hillf Danton authored and torvalds committed Mar 22, 2012
1 parent b69add2 commit d1d5e05
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fs/hugetlbfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1021,6 +1021,7 @@ static int __init init_hugetlbfs_fs(void)
if (error)
return error;

error = -ENOMEM;
hugetlbfs_inode_cachep = kmem_cache_create("hugetlbfs_inode_cache",
sizeof(struct hugetlbfs_inode_info),
0, 0, init_once);
Expand All @@ -1039,10 +1040,10 @@ static int __init init_hugetlbfs_fs(void)
}

error = PTR_ERR(vfsmount);
unregister_filesystem(&hugetlbfs_fs_type);

out:
if (error)
kmem_cache_destroy(hugetlbfs_inode_cachep);
kmem_cache_destroy(hugetlbfs_inode_cachep);
out2:
bdi_destroy(&hugetlbfs_backing_dev_info);
return error;
Expand Down

0 comments on commit d1d5e05

Please sign in to comment.