X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=net%2Fbluetooth%2Fsco.c;fp=net%2Fbluetooth%2Fsco.c;h=6b61323ce23cad772371657cf18833027f56d0f9;hb=64ba3f394c830ec48a1c31b53dcae312c56f1604;hp=7714a2ec3854d032ed0038ebcc8aea5e39494de7;hpb=be1e6109ac94a859551f8e1774eb9a8469fe055c;p=linux-2.6.git diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index 7714a2ec3..6b61323ce 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c @@ -24,6 +24,7 @@ /* Bluetooth SCO sockets. */ +#include #include #include @@ -108,14 +109,17 @@ static void sco_sock_init_timer(struct sock *sk) static struct sco_conn *sco_conn_add(struct hci_conn *hcon, __u8 status) { struct hci_dev *hdev = hcon->hdev; - struct sco_conn *conn = hcon->sco_data; + struct sco_conn *conn; - if (conn || status) + if ((conn = hcon->sco_data)) return conn; - conn = kzalloc(sizeof(struct sco_conn), GFP_ATOMIC); - if (!conn) + if (status) + return conn; + + if (!(conn = kmalloc(sizeof(struct sco_conn), GFP_ATOMIC))) return NULL; + memset(conn, 0, sizeof(struct sco_conn)); spin_lock_init(&conn->lock); @@ -131,7 +135,6 @@ static struct sco_conn *sco_conn_add(struct hci_conn *hcon, __u8 status) conn->mtu = 60; BT_DBG("hcon %p conn %p", hcon, conn); - return conn; } @@ -252,7 +255,7 @@ static inline int sco_send_frame(struct sock *sk, struct msghdr *msg, int len) } if ((err = hci_send_sco(conn->hcon, skb)) < 0) - return err; + goto fail; return count; @@ -967,7 +970,7 @@ static int __init sco_init(void) goto error; } - class_create_file(bt_class, &class_attr_sco); + class_create_file(&bt_class, &class_attr_sco); BT_INFO("SCO (Voice Link) ver %s", VERSION); BT_INFO("SCO socket layer initialized"); @@ -981,7 +984,7 @@ error: static void __exit sco_exit(void) { - class_remove_file(bt_class, &class_attr_sco); + class_remove_file(&bt_class, &class_attr_sco); if (bt_sock_unregister(BTPROTO_SCO) < 0) BT_ERR("SCO socket unregistration failed");