/** * frees all the memory allocated * * @param ptr pointer to "xhci_ctrl" to be cleaned up * @return none */ void xhci_cleanup(struct xhci_ctrl *ctrl) { xhci_ring_free(ctrl->event_ring); xhci_ring_free(ctrl->cmd_ring); xhci_free_virt_devices(ctrl); free(ctrl->erst.entries); free(ctrl->dcbaa); memset(ctrl, '\0', sizeof(struct xhci_ctrl)); }
/** * frees all the memory allocated * * @param ptr pointer to "xhci_ctrl" to be cleaned up * @return none */ void xhci_cleanup(struct xhci_ctrl *ctrl) { if (ctrl->event_ring) xhci_ring_free(ctrl->event_ring); if (ctrl->cmd_ring) xhci_ring_free(ctrl->cmd_ring); if (ctrl) xhci_free_virt_devices(ctrl); if (ctrl->erst.entries) free(KSEG0ADDR(ctrl->erst.entries)); if (ctrl->dcbaa) free(KSEG0ADDR(ctrl->dcbaa)); memset(ctrl, '\0', sizeof(struct xhci_ctrl)); }