Skip to content

Commit

Permalink
usb: Fix xid device removal
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryzee119 authored and thrimbor committed Jul 22, 2021
1 parent fdb6e38 commit f2c634f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/usb/libusbohci_xbox/xid_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,16 @@ static xid_dev_t *alloc_xid_device(void) {
}

static void free_xid_device(xid_dev_t *xid_dev) {
//Find the device head in the linked list
xid_dev_t *head = pxid_list;

//If the xid is at the head of the list, remove now.
if (xid_dev == head)
{
pxid_list = head->next;
head = NULL;
}

//Find the device head in the linked list
while (head != NULL && head->next != xid_dev)
{
head = head->next;
Expand Down

0 comments on commit f2c634f

Please sign in to comment.