static int ipcomp6_init_state(struct xfrm_state *x, void *args) 
static int ipcomp6_init_state(struct xfrm_state *x) 
static int ipcomp6_init_state(struct xfrm_state *x, void *args){	int err;	struct ipcomp_data *ipcd;	struct xfrm_algo_desc *calg_desc;	err = -EINVAL;	if (!x->calg)		goto out;	if (x->encap)		goto out;	err = -ENOMEM;	ipcd = kmalloc(sizeof(*ipcd), GFP_KERNEL);	if (!ipcd)		goto out;	memset(ipcd, 0, sizeof(*ipcd));	x->props.header_len = 0;	if (x->props.mode)		x->props.header_len += sizeof(struct ipv6hdr);		down(&ipcomp6_resource_sem);	if (!ipcomp6_alloc_scratches())		goto error;	ipcd->tfms = ipcomp6_alloc_tfms(x->calg->alg_name);	if (!ipcd->tfms)		goto error;	up(&ipcomp6_resource_sem);	if (x->props.mode) {		err = ipcomp6_tunnel_attach(x);		if (err)			goto error_tunnel;	}	calg_desc = xfrm_calg_get_byname(x->calg->alg_name, 0);	BUG_ON(!calg_desc);	ipcd->threshold = calg_desc->uinfo.comp.threshold;	x->data = ipcd;	err = 0;out:	return err;error_tunnel:	down(&ipcomp6_resource_sem);error:	ipcomp6_free_data(ipcd);	up(&ipcomp6_resource_sem);	kfree(ipcd);	goto out;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/72cb6962a91f2af9eef69a06198e1949c10259ae/ipcomp6.c/clean/net/ipv6/ipcomp6.c