[Bluetooth] Handle return values from driver core functions
authorMarcel Holtmann <marcel@holtmann.org>
Sun, 15 Oct 2006 15:30:45 +0000 (17:30 +0200)
committerDavid S. Miller <davem@sunset.davemloft.net>
Mon, 16 Oct 2006 06:14:28 +0000 (23:14 -0700)
Some return values of the driver core register and create functions
are not handled and so might cause unexpected problems.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/hci_sysfs.c
net/bluetooth/l2cap.c
net/bluetooth/rfcomm/core.c
net/bluetooth/rfcomm/sock.c
net/bluetooth/sco.c

index 989b22d9042e92f929435d9f0290d2d429e7fd75..c7e079d3c486c08bccf208f1f0bd36d7256a3e03 100644 (file)
@@ -242,10 +242,14 @@ static void add_conn(void *data)
        struct hci_conn *conn = data;
        int i;
 
-       device_register(&conn->dev);
+       if (device_register(&conn->dev) < 0) {
+               BT_ERR("Failed to register connection device");
+               return;
+       }
 
        for (i = 0; conn_attrs[i]; i++)
-               device_create_file(&conn->dev, conn_attrs[i]);
+               if (device_create_file(&conn->dev, conn_attrs[i]) < 0)
+                       BT_ERR("Failed to create connection attribute");
 }
 
 void hci_conn_add_sysfs(struct hci_conn *conn)
@@ -312,7 +316,8 @@ int hci_register_sysfs(struct hci_dev *hdev)
                return err;
 
        for (i = 0; bt_attrs[i]; i++)
-               device_create_file(dev, bt_attrs[i]);
+               if (device_create_file(dev, bt_attrs[i]) < 0)
+                       BT_ERR("Failed to create device attribute");
 
        return 0;
 }
index d56f60b392ac512b36a736f928844208ec88847a..66fc621a077cd2cb126e3013527fb5fdf014d459 100644 (file)
@@ -2216,7 +2216,8 @@ static int __init l2cap_init(void)
                goto error;
        }
 
-       class_create_file(bt_class, &class_attr_l2cap);
+       if (class_create_file(bt_class, &class_attr_l2cap) < 0)
+               BT_ERR("Failed to create L2CAP info file");
 
        BT_INFO("L2CAP ver %s", VERSION);
        BT_INFO("L2CAP socket layer initialized");
index 468df3b953f6d3c615169a0939e50ec924eb1af8..ddc4e9d5963e850f86d768abef9481f849392439 100644 (file)
@@ -2058,7 +2058,8 @@ static int __init rfcomm_init(void)
 
        kernel_thread(rfcomm_run, NULL, CLONE_KERNEL);
 
-       class_create_file(bt_class, &class_attr_rfcomm_dlc);
+       if (class_create_file(bt_class, &class_attr_rfcomm_dlc) < 0)
+               BT_ERR("Failed to create RFCOMM info file");
 
        rfcomm_init_sockets();
 
index 220fee04e7f274a3d31505f0133af59e742a4f74..530cc41f3a22136819a036d094bf4c667d1c71a2 100644 (file)
@@ -944,7 +944,8 @@ int __init rfcomm_init_sockets(void)
        if (err < 0)
                goto error;
 
-       class_create_file(bt_class, &class_attr_rfcomm);
+       if (class_create_file(bt_class, &class_attr_rfcomm) < 0)
+               BT_ERR("Failed to create RFCOMM info file");
 
        BT_INFO("RFCOMM socket layer initialized");
 
index 7714a2ec3854d032ed0038ebcc8aea5e39494de7..14b0f6930637d6f5ce7d13618d796cbfd0161ded 100644 (file)
@@ -967,7 +967,8 @@ static int __init sco_init(void)
                goto error;
        }
 
-       class_create_file(bt_class, &class_attr_sco);
+       if (class_create_file(bt_class, &class_attr_sco) < 0)
+               BT_ERR("Failed to create SCO info file");
 
        BT_INFO("SCO (Voice Link) ver %s", VERSION);
        BT_INFO("SCO socket layer initialized");