Most callsites of unload_nls() do if (nls) unload_nls(nls); Check the pointer inside unload_nls() like we do in kfree() so we can simplify the call sites. Signed-off-by: Thomas Gleixner --- fs/nls/nls_base.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) Index: linux-2.6-tip/fs/nls/nls_base.c =================================================================== --- linux-2.6-tip.orig/fs/nls/nls_base.c +++ linux-2.6-tip/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] = {