From 6d729e44a55547c009d7a87ea66bff21a8e0afea Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Sun, 16 Aug 2009 21:05:08 +0000 Subject: fs: Make unload_nls() NULL pointer safe Most call sites of unload_nls() do: if (nls) unload_nls(nls); Check the pointer inside unload_nls() like we do in kfree() and simplify the call sites. Signed-off-by: Thomas Gleixner Cc: Steve French Cc: OGAWA Hirofumi Cc: Roman Zippel Cc: Dave Kleikamp Cc: Petr Vandrovec Cc: Anton Altaparmakov Signed-off-by: Al Viro --- fs/nls/nls_base.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'fs/nls') diff --git a/fs/nls/nls_base.c b/fs/nls/nls_base.c index 477d37d83b3..2224b4d07bf 100644 --- a/fs/nls/nls_base.c +++ b/fs/nls/nls_base.c @@ -270,7 +270,8 @@ struct nls_table *load_nls(char *charset) void unload_nls(struct nls_table *nls) { - module_put(nls->owner); + if (nls) + module_put(nls->owner); } static const wchar_t charset2uni[256] = { -- cgit v1.2.3-70-g09d2