if (session->input) 
if (session->input) { 
int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock, struct socket *intr_sock){	struct hidp_session *session, *s;	int err;	BT_DBG("");	if (bacmp(&bt_sk(ctrl_sock->sk)->src, &bt_sk(intr_sock->sk)->src) ||			bacmp(&bt_sk(ctrl_sock->sk)->dst, &bt_sk(intr_sock->sk)->dst))		return -ENOTUNIQ;	session = kmalloc(sizeof(struct hidp_session), GFP_KERNEL);	if (!session) 		return -ENOMEM;	memset(session, 0, sizeof(struct hidp_session));	session->input = kmalloc(sizeof(struct input_dev), GFP_KERNEL);	if (!session->input) {		kfree(session);		return -ENOMEM;	}	memset(session->input, 0, sizeof(struct input_dev));	down_write(&hidp_session_sem);	s = __hidp_get_session(&bt_sk(ctrl_sock->sk)->dst);	if (s && s->state == BT_CONNECTED) {		err = -EEXIST;		goto failed;	}	bacpy(&session->bdaddr, &bt_sk(ctrl_sock->sk)->dst);	session->ctrl_mtu = min_t(uint, l2cap_pi(ctrl_sock->sk)->omtu, l2cap_pi(ctrl_sock->sk)->imtu);	session->intr_mtu = min_t(uint, l2cap_pi(intr_sock->sk)->omtu, l2cap_pi(intr_sock->sk)->imtu);	BT_DBG("ctrl mtu %d intr mtu %d", session->ctrl_mtu, session->intr_mtu);	session->ctrl_sock = ctrl_sock;	session->intr_sock = intr_sock;	session->state     = BT_CONNECTED;	init_timer(&session->timer);	session->timer.function = hidp_idle_timeout;	session->timer.data     = (unsigned long) session;	skb_queue_head_init(&session->ctrl_transmit);	skb_queue_head_init(&session->intr_transmit);	session->flags   = req->flags & (1 << HIDP_BLUETOOTH_VENDOR_ID);	session->idle_to = req->idle_to;	if (session->input)		hidp_setup_input(session, req);	__hidp_link_session(session);	hidp_set_timer(session);	err = kernel_thread(hidp_session, session, CLONE_KERNEL);	if (err < 0)		goto unlink;	if (session->input) {		hidp_send_ctrl_message(session,			HIDP_TRANS_SET_PROTOCOL | HIDP_PROTO_BOOT, NULL, 0);		session->flags |= (1 << HIDP_BOOT_PROTOCOL_MODE);		session->leds = 0xff;		hidp_input_event(session->input, EV_LED, 0, 0);	}	up_write(&hidp_session_sem);	return 0;unlink:	hidp_del_timer(session);	__hidp_unlink_session(session);	if (session->input)		input_unregister_device(session->input);failed:	up_write(&hidp_session_sem);	if (session->input)		kfree(session->input);	kfree(session);	return err;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/34abf91f4036c01669e298e649b7ba85cadf82eb/core.c/clean/net/bluetooth/hidp/core.c