Thread (3 messages) flat view 3 messages, 2 authors, 2011-02-21

Re: [PATCH 2/2] Bluetooth: Use ERR_PTR as return error from hci_connect

From: Gustavo F. Padovan <hidden>
Date: 2011-02-21 20:59:32

Possibly related (same subject, not in this thread)

Hi,

* anderson.briglia@openbossa.org [off-list ref] [2011-02-21 15:09:24 -0300]:
quoted hunk ↗ jump to hunk
From: Ville Tervo <redacted>

Use ERR_PRT mechanism to return error from hci_connect.

Signed-off-by: Ville Tervo <redacted>
Signed-off-by: Anderson Briglia <redacted>
---
 net/bluetooth/hci_conn.c   |    8 ++++----
 net/bluetooth/l2cap_core.c |   10 ++++------
 net/bluetooth/sco.c        |    6 +++---
 3 files changed, 11 insertions(+), 13 deletions(-)
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index d401775..06af539 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -430,10 +430,10 @@ struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8
 	if (type == LE_LINK) {
 		le = hci_conn_hash_lookup_ba(hdev, LE_LINK, dst);
 		if (le)
-			return NULL;
+			return ERR_PTR(-EBUSY);
 		le = hci_conn_add(hdev, LE_LINK, dst);
 		if (!le)
-			return NULL;
+			return ERR_PTR(-ENOMEM);
 		if (le->state == BT_OPEN)
 			hci_le_connect(le);
 
@@ -445,8 +445,8 @@ struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8
 	acl = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst);
 	if (!acl) {
 		acl = hci_conn_add(hdev, ACL_LINK, dst);
-		if (!acl)
-			return NULL;
+		if (IS_ERR(acl))
+			return acl;
hci_conn_add() doesn't use the ERR_PTR magic.


-- 
Gustavo F. Padovan
http://profusion.mobi
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help