Skip to content

Commit

Permalink
[Bluetooth] Handle device registration failures
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Marcel Holtmann authored and David S. Miller committed Jan 9, 2007
1 parent 4d6a218 commit c893779
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion net/bluetooth/hci_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ static void add_conn(struct work_struct *work)
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;
}
Expand Down Expand Up @@ -272,6 +272,8 @@ void hci_conn_add_sysfs(struct hci_conn *conn)

dev_set_drvdata(&conn->dev, conn);

device_initialize(&conn->dev);

INIT_WORK(&conn->work, add_conn);

schedule_work(&conn->work);
Expand All @@ -287,6 +289,9 @@ void hci_conn_del_sysfs(struct hci_conn *conn)
{
BT_DBG("conn %p", conn);

if (!device_is_registered(&conn->dev))
return;

INIT_WORK(&conn->work, del_conn);

schedule_work(&conn->work);
Expand Down

0 comments on commit c893779

Please sign in to comment.