In the case the device registration for a new Bluetooth low-level
connection fails there is no need to unregister it when the temporary
data structure has been removed.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
struct hci_conn *conn = container_of(work, struct hci_conn, work);
int i;
struct hci_conn *conn = container_of(work, struct hci_conn, work);
int i;
- if (device_register(&conn->dev) < 0) {
+ if (device_add(&conn->dev) < 0) {
BT_ERR("Failed to register connection device");
return;
}
BT_ERR("Failed to register connection device");
return;
}
dev_set_drvdata(&conn->dev, conn);
dev_set_drvdata(&conn->dev, conn);
+ device_initialize(&conn->dev);
+
INIT_WORK(&conn->work, add_conn);
schedule_work(&conn->work);
INIT_WORK(&conn->work, add_conn);
schedule_work(&conn->work);
{
BT_DBG("conn %p", conn);
{
BT_DBG("conn %p", conn);
+ if (!device_is_registered(&conn->dev))
+ return;
+
INIT_WORK(&conn->work, del_conn);
schedule_work(&conn->work);
INIT_WORK(&conn->work, del_conn);
schedule_work(&conn->work);