Changeset a6c4597 in mainline


Ignore:
Timestamp:
2018-01-11T04:12:06Z (6 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bad4a05
Parents:
f82c4822
git-author:
Ondřej Hlavatý <aearsis@…> (2018-01-10 22:26:56)
git-committer:
Ondřej Hlavatý <aearsis@…> (2018-01-11 04:12:06)
Message:

usbhost: survive unregistering detached endpoint

File:
1 edited

Legend:

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

    rf82c4822 ra6c4597  
    199199            ep->max_transfer_size);
    200200
    201         fibril_mutex_lock(&bus->guard);
     201        fibril_mutex_lock(&device->guard);
    202202        if (!device->online && ep->endpoint != 0) {
    203203                err = EAGAIN;
     
    209209                        device->endpoints[ep->endpoint] = ep;
    210210        }
    211         fibril_mutex_unlock(&bus->guard);
     211        fibril_mutex_unlock(&device->guard);
    212212        if (err) {
    213213                endpoint_del_ref(ep);
     
    231231        assert(device);
    232232
    233         bus_t *bus = device->bus;
    234 
    235         fibril_mutex_lock(&bus->guard);
     233        fibril_mutex_lock(&device->guard);
    236234        endpoint_t *ep = device->endpoints[endpoint];
    237235        if (ep) {
     
    239237                endpoint_add_ref(ep);
    240238        }
    241         fibril_mutex_unlock(&bus->guard);
     239        fibril_mutex_unlock(&device->guard);
    242240        return ep;
    243241}
     
    251249        assert(ep->device);
    252250
    253         bus_t *bus = endpoint_get_bus(ep);
     251        device_t *device = ep->device;
     252        if (!device)
     253                return ENOENT;
     254
     255        bus_t *bus = device->bus;
    254256
    255257        const bus_ops_t *ops = BUS_OPS_LOOKUP(bus->ops, endpoint_unregister);
     
    258260
    259261        usb_log_debug("Unregister endpoint %d:%d %s-%s %zuB.\n",
    260             ep->device->address, ep->endpoint,
     262            device->address, ep->endpoint,
    261263            usb_str_transfer_type(ep->transfer_type),
    262264            usb_str_direction(ep->direction),
    263265            ep->max_transfer_size);
    264266
    265         fibril_mutex_lock(&bus->guard);
     267        fibril_mutex_lock(&device->guard);
    266268        const int r = ops->endpoint_unregister(ep);
    267269        if (!r)
    268                 ep->device->endpoints[ep->endpoint] = NULL;
    269         fibril_mutex_unlock(&bus->guard);
     270                device->endpoints[ep->endpoint] = NULL;
     271        fibril_mutex_unlock(&device->guard);
    270272
    271273        if (r)
Note: See TracChangeset for help on using the changeset viewer.