XHCI fix xhci_delete_usb_device with a null check, usbdrv Implement usbdrv_fini
This commit is contained in:
@@ -207,6 +207,8 @@ DEFINE_DEVICE_INIT (usbdrv_init) {
|
|||||||
usbdrv->xhci = init->xhci;
|
usbdrv->xhci = init->xhci;
|
||||||
usbdrv->usb_device = init->usb_device;
|
usbdrv->usb_device = init->usb_device;
|
||||||
|
|
||||||
|
device->udata = usbdrv;
|
||||||
|
|
||||||
usbdrv_setup_endpoints (usbdrv);
|
usbdrv_setup_endpoints (usbdrv);
|
||||||
|
|
||||||
ret =
|
ret =
|
||||||
@@ -236,4 +238,8 @@ DEFINE_DEVICE_INIT (usbdrv_init) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_DEVICE_FINI (usbdrv_fini) {}
|
DEFINE_DEVICE_FINI (usbdrv_fini) {
|
||||||
|
struct usbdrv* usbdrv = device->udata;
|
||||||
|
|
||||||
|
free (usbdrv);
|
||||||
|
}
|
||||||
|
|||||||
@@ -69,17 +69,19 @@ static void xhci_delete_usb_device (struct xhci* xhci, struct xhci_port* xhci_po
|
|||||||
list_find (struct xhci_usb_device, xhci->xhci_usb_devices, usb_device, xhci_port->port_value,
|
list_find (struct xhci_usb_device, xhci->xhci_usb_devices, usb_device, xhci_port->port_value,
|
||||||
xhci_port->port_value, usb_devices_link);
|
xhci_port->port_value, usb_devices_link);
|
||||||
|
|
||||||
device_delete (usb_device->device->key, proc, rctx);
|
if (usb_device != NULL) {
|
||||||
|
device_delete (usb_device->device->key, proc, rctx);
|
||||||
|
|
||||||
list_remove (xhci->xhci_usb_devices, &usb_device->usb_devices_link);
|
list_remove (xhci->xhci_usb_devices, &usb_device->usb_devices_link);
|
||||||
|
|
||||||
if (usb_device->endpoint0_ring.phys != 0)
|
if (usb_device->endpoint0_ring.phys != 0)
|
||||||
pmm_free (usb_device->endpoint0_ring.phys, 1);
|
pmm_free (usb_device->endpoint0_ring.phys, 1);
|
||||||
|
|
||||||
pmm_free (xhci->xhci_dcbaa[usb_device->slot_id], 1);
|
pmm_free (xhci->xhci_dcbaa[usb_device->slot_id], 1);
|
||||||
xhci->xhci_dcbaa[usb_device->slot_id] = 0;
|
xhci->xhci_dcbaa[usb_device->slot_id] = 0;
|
||||||
|
|
||||||
free (usb_device);
|
free (usb_device);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xhci_bios_handover (struct xhci* xhci) {
|
static void xhci_bios_handover (struct xhci* xhci) {
|
||||||
|
|||||||
Reference in New Issue
Block a user