Skip to content

Commit

Permalink
Bluetooth: Fix hidp_get_connection()
Browse files Browse the repository at this point in the history
This functions needs crtl_sock and intr_sock to be set first.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
  • Loading branch information
Gustavo F. Padovan committed Nov 7, 2011
1 parent 25df084 commit 3c32fa9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions net/bluetooth/hidp/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -996,12 +996,6 @@ int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock,
return -ENOMEM;
}

session->conn = hidp_get_connection(session);
if (!session->conn) {
err = -ENOTCONN;
goto failed;
}

bacpy(&session->bdaddr, &bt_sk(ctrl_sock->sk)->dst);

session->ctrl_mtu = min_t(uint, l2cap_pi(ctrl_sock->sk)->chan->omtu,
Expand All @@ -1015,6 +1009,12 @@ int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock,
session->intr_sock = intr_sock;
session->state = BT_CONNECTED;

session->conn = hidp_get_connection(session);
if (!session->conn) {
err = -ENOTCONN;
goto failed;
}

setup_timer(&session->timer, hidp_idle_timeout, (unsigned long)session);

skb_queue_head_init(&session->ctrl_transmit);
Expand Down

0 comments on commit 3c32fa9

Please sign in to comment.