sunrpc: fix error path in module_init
[powerpc.git] / net / sunrpc / sunrpc_syms.c
index d85fdde..0d35bc7 100644 (file)
@@ -9,7 +9,6 @@
 #include <linux/module.h>
 
 #include <linux/types.h>
-#include <linux/sched.h>
 #include <linux/uio.h>
 #include <linux/unistd.h>
 #include <linux/init.h>
@@ -137,7 +136,7 @@ EXPORT_SYMBOL(nlm_debug);
 
 extern int register_rpc_pipefs(void);
 extern void unregister_rpc_pipefs(void);
-extern struct cache_detail ip_map_cache;
+extern struct cache_detail ip_map_cache, unix_gid_cache;
 extern int init_socket_xprt(void);
 extern void cleanup_socket_xprt(void);
 
@@ -147,9 +146,11 @@ init_sunrpc(void)
        int err = register_rpc_pipefs();
        if (err)
                goto out;
-       err = rpc_init_mempool() != 0;
-       if (err)
+       err = rpc_init_mempool();
+       if (err) {
+               unregister_rpc_pipefs();
                goto out;
+       }
 #ifdef RPC_DEBUG
        rpc_register_sysctl();
 #endif
@@ -157,6 +158,7 @@ init_sunrpc(void)
        rpc_proc_init();
 #endif
        cache_register(&ip_map_cache);
+       cache_register(&unix_gid_cache);
        init_socket_xprt();
 out:
        return err;
@@ -170,6 +172,8 @@ cleanup_sunrpc(void)
        rpc_destroy_mempool();
        if (cache_unregister(&ip_map_cache))
                printk(KERN_ERR "sunrpc: failed to unregister ip_map cache\n");
+       if (cache_unregister(&unix_gid_cache))
+             printk(KERN_ERR "sunrpc: failed to unregister unix_gid cache\n");
 #ifdef RPC_DEBUG
        rpc_unregister_sysctl();
 #endif