diff options
author | Andrei Emeltchenko <andrei.emeltchenko@intel.com> | 2012-10-18 06:16:19 -0400 |
---|---|---|
committer | Gustavo Padovan <gustavo.padovan@collabora.co.uk> | 2012-10-18 06:27:20 -0400 |
commit | f706adfeade767d2194c9f39c0f75e944b0bdd23 (patch) | |
tree | a047952d3ce06440c9743cc5b582079d5df37030 /net/bluetooth | |
parent | 56f6098441adb9487f6e0439429fc536afcf9e71 (diff) |
Bluetooth: AMP: Get amp_mgr reference in HS hci_conn
When assigning amp_mgr in hci_conn (type AMP_LINK) get also reference.
In hci_conn_del those references would be put for both conn types
AMP_LINK and ACL_LINK associated with amp_mgr.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/a2mp.c | 4 | ||||
-rw-r--r-- | net/bluetooth/amp.c | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c index 7bf9a10d8e46..d5136cfb57e2 100644 --- a/net/bluetooth/a2mp.c +++ b/net/bluetooth/a2mp.c | |||
@@ -751,11 +751,13 @@ static struct l2cap_chan *a2mp_chan_open(struct l2cap_conn *conn, bool locked) | |||
751 | } | 751 | } |
752 | 752 | ||
753 | /* AMP Manager functions */ | 753 | /* AMP Manager functions */ |
754 | void amp_mgr_get(struct amp_mgr *mgr) | 754 | struct amp_mgr *amp_mgr_get(struct amp_mgr *mgr) |
755 | { | 755 | { |
756 | BT_DBG("mgr %p orig refcnt %d", mgr, atomic_read(&mgr->kref.refcount)); | 756 | BT_DBG("mgr %p orig refcnt %d", mgr, atomic_read(&mgr->kref.refcount)); |
757 | 757 | ||
758 | kref_get(&mgr->kref); | 758 | kref_get(&mgr->kref); |
759 | |||
760 | return mgr; | ||
759 | } | 761 | } |
760 | 762 | ||
761 | static void amp_mgr_destroy(struct kref *kref) | 763 | static void amp_mgr_destroy(struct kref *kref) |
diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c index 59da0f15818e..231d7ef53ecb 100644 --- a/net/bluetooth/amp.c +++ b/net/bluetooth/amp.c | |||
@@ -123,7 +123,7 @@ struct hci_conn *phylink_add(struct hci_dev *hdev, struct amp_mgr *mgr, | |||
123 | hcon->attempt++; | 123 | hcon->attempt++; |
124 | hcon->handle = __next_handle(mgr); | 124 | hcon->handle = __next_handle(mgr); |
125 | hcon->remote_id = remote_id; | 125 | hcon->remote_id = remote_id; |
126 | hcon->amp_mgr = mgr; | 126 | hcon->amp_mgr = amp_mgr_get(mgr); |
127 | hcon->out = out; | 127 | hcon->out = out; |
128 | 128 | ||
129 | return hcon; | 129 | return hcon; |