hci_dev_lock(hdev);
- if (user->list.next || user->list.prev) {
+ if (!list_empty(&user->list)) {
ret = -EINVAL;
goto out_unlock;
}
hci_dev_lock(hdev);
- if (!user->list.next || !user->list.prev)
+ if (list_empty(&user->list))
goto out_unlock;
list_del(&user->list);
- user->list.next = NULL;
- user->list.prev = NULL;
user->remove(conn, user);
out_unlock:
while (!list_empty(&conn->users)) {
user = list_first_entry(&conn->users, struct l2cap_user, list);
list_del(&user->list);
- user->list.next = NULL;
- user->list.prev = NULL;
user->remove(conn, user);
}
}