Changeset 7278cbc9 in mainline for uspace/lib/usbhost/src/bus.c


Ignore:
Timestamp:
2018-01-22T23:53:11Z (7 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e546142
Parents:
3ac86a4
Message:

usbhost: dispose the EP0 properly (+some ehci cleanup while debugging)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbhost/src/bus.c

    r3ac86a4 r7278cbc9  
    208208
    209209        const bus_ops_t *ops = BUS_OPS_LOOKUP(dev->bus->ops, device_gone);
     210        const bus_ops_t *ep_ops = BUS_OPS_LOOKUP(dev->bus->ops, endpoint_unregister);
    210211        assert(ops);
    211212
     
    240241
    241242        /* Tell the HC to release its resources. */
    242         ops->device_gone(dev);
    243 
    244         /* Release the EP0 bus reference */
    245         endpoint_del_ref(dev->endpoints[0]);
     243        if (ops)
     244                ops->device_gone(dev);
     245
     246        /* Check whether the driver didn't forgot EP0 */
     247        if (dev->endpoints[0]) {
     248                if (ep_ops)
     249                        ep_ops->endpoint_unregister(dev->endpoints[0]);
     250                /* Release the EP0 bus reference */
     251                endpoint_del_ref(dev->endpoints[0]);
     252        }
    246253
    247254        /* Destroy the function, freeing also the device, unlocking mutex. */
Note: See TracChangeset for help on using the changeset viewer.