}
 
 #ifdef CONFIG_XFRM
-
 extern int __xfrm_policy_check(struct sock *, int dir, struct sk_buff *skb, unsigned short family);
 
 static inline int xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb, unsigned short family)
 
 extern void xfrm_init(void);
 extern void xfrm4_init(void);
-extern int xfrm6_init(void);
-extern void xfrm6_fini(void);
 extern void xfrm_state_init(void);
 extern void xfrm4_state_init(void);
+#ifdef CONFIG_XFRM
+extern int xfrm6_init(void);
+extern void xfrm6_fini(void);
 extern int xfrm6_state_init(void);
 extern void xfrm6_state_fini(void);
+#else
+static inline int xfrm6_init(void)
+{
+       return 0;
+}
+static inline void xfrm6_fini(void)
+{
+       ;
+}
+#endif
 
 extern int xfrm_state_walk(u8 proto, int (*func)(struct xfrm_state *, int, void*), void *);
 extern struct xfrm_state *xfrm_state_alloc(void);
 
        if (ret)
                goto out_fib6_init;
 
-#ifdef CONFIG_XFRM
        ret = xfrm6_init();
        if (ret)
                goto out_proc_init;
-#endif
+
 #ifdef CONFIG_IPV6_MULTIPLE_TABLES
        ret = fib6_rules_init();
        if (ret)
        fib6_rules_cleanup();
 xfrm6_init:
 #endif
-#ifdef CONFIG_XFRM
        xfrm6_fini();
-#endif
 out_proc_init:
        ipv6_route_proc_fini(&init_net);
 out_fib6_init:
        fib6_rules_cleanup();
 #endif
        ipv6_route_proc_fini(&init_net);
-#ifdef CONFIG_XFRM
        xfrm6_fini();
-#endif
        rt6_ifdown(NULL);
        fib6_gc_cleanup();
        kmem_cache_destroy(ip6_dst_ops.kmem_cachep);