diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2012-02-19 14:06:48 +0200 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2012-02-19 14:22:11 +0200 |
commit | 48c7aba91f372251867d15efc9cf694ceee2de02 (patch) | |
tree | 457ae2383babe549913ee00c40370d978bd243ef /net/bluetooth/hci_conn.c | |
parent | 2da9c55c5a4a0b8f0348b7acd70d8b08a6ae4573 (diff) | |
download | blackbird-op-linux-48c7aba91f372251867d15efc9cf694ceee2de02.tar.gz blackbird-op-linux-48c7aba91f372251867d15efc9cf694ceee2de02.zip |
Bluetooth: Fix hci_connect error return values
The hci_connect function should either return a valid hci_conn pointer
or a ERR_PTR() but never NULL. This patch fixes the two places where
hci_conn_add failures would have caused a NULL return. The only reason
for failure with hci_conn_add is memory allocation so ENOMEM seems to be
a good choice here.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/hci_conn.c')
-rw-r--r-- | net/bluetooth/hci_conn.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 7ee6895c4b0c..8549d04e3313 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c @@ -551,7 +551,7 @@ struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8 if (!acl) { acl = hci_conn_add(hdev, ACL_LINK, dst); if (!acl) - return NULL; + return ERR_PTR(-ENOMEM); } hci_conn_hold(acl); @@ -571,7 +571,7 @@ struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8 sco = hci_conn_add(hdev, type, dst); if (!sco) { hci_conn_put(acl); - return NULL; + return ERR_PTR(-ENOMEM); } } |