Hi Briglia, * anderson.briglia@xxxxxxxxxxxxx <anderson.briglia@xxxxxxxxxxxxx> [2011-02-22 16:10:53 -0300]: > From: Ville Tervo <ville.tervo@xxxxxxxxx> > > Use ERR_PTR mechanism to return error from hci_connect. > > Signed-off-by: Ville Tervo <ville.tervo@xxxxxxxxx> > Signed-off-by: Anderson Briglia <anderson.briglia@xxxxxxxxxxxxx> > --- > 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 -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html