From: "Gustavo F. Padovan" <padovan@profusion.mobi>
To: anderson.briglia@openbossa.org
Cc: linux-bluetooth@vger.kernel.org, Ville Tervo <ville.tervo@nokia.com>
Subject: Re: [PATCH v2] Bluetooth: Use ERR_PTR as return error from hci_connect
Date: Sun, 27 Feb 2011 17:12:22 -0300 [thread overview]
Message-ID: <20110227201222.GE2166@joana> (raw)
In-Reply-To: <4d640a47.a21fec0a.065e.466f@mx.google.com>
Hi Briglia,
* anderson.briglia@openbossa.org <anderson.briglia@openbossa.org> [2011-02-22 16:10:53 -0300]:
> From: Ville Tervo <ville.tervo@nokia.com>
>
> Use ERR_PTR mechanism to return error from hci_connect.
>
> Signed-off-by: Ville Tervo <ville.tervo@nokia.com>
> Signed-off-by: Anderson Briglia <anderson.briglia@openbossa.org>
> ---
> net/bluetooth/hci_conn.c | 4 ++--
> net/bluetooth/l2cap_core.c | 10 ++++------
> net/bluetooth/mgmt.c | 4 ++--
> net/bluetooth/sco.c | 6 +++---
> 4 files changed, 11 insertions(+), 13 deletions(-)
Patch is applied now, but I had to fix it, your error handling was still
wrong. Here are the changes I did to your patch:
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 0bbb6c6..c9f9cec 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -841,7 +841,7 @@ int l2cap_do_connect(struct sock *sk)
struct hci_conn *hcon;
struct hci_dev *hdev;
__u8 auth_type;
- int err = 0;
+ int err;
BT_DBG("%s -> %s psm 0x%2.2x", batostr(src), batostr(dst),
l2cap_pi(sk)->psm);
@@ -869,6 +869,7 @@ int l2cap_do_connect(struct sock *sk)
conn = l2cap_conn_add(hcon, 0);
if (!conn) {
hci_conn_put(hcon);
+ err = -ENOMEM;
goto done;
}
@@ -890,6 +891,8 @@ int l2cap_do_connect(struct sock *sk)
l2cap_do_start(sk);
}
+ err = 0;
+
done:
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index 26f2f04..42fdffd 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -204,6 +204,7 @@ static int sco_connect(struct sock *sk)
conn = sco_conn_add(hcon, 0);
if (!conn) {
hci_conn_put(hcon);
+ err = -ENOMEM;
goto done;
}
--
Gustavo F. Padovan
http://profusion.mobi
prev parent reply other threads:[~2011-02-27 20:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-22 19:10 [PATCH v2] Bluetooth: Use ERR_PTR as return error from hci_connect anderson.briglia
2011-02-27 20:12 ` Gustavo F. Padovan [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110227201222.GE2166@joana \
--to=padovan@profusion.mobi \
--cc=anderson.briglia@openbossa.org \
--cc=linux-bluetooth@vger.kernel.org \
--cc=ville.tervo@nokia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).