Ignore:
Timestamp:
2011-07-11T09:28:00Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ece7f78
Parents:
1cb4f05
Message:

libusbhost: endpoint_t uses get/destroy pair, instead of init/destroy.

endpoint_init always returned EOK, thus allocation could be moved in.
Also, it makes no sense to create this structures on stack.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbhost/include/usb/host/usb_endpoint_manager.h

    r1cb4f05 raa81adc  
    8282    size_t data_size)
    8383{
    84         endpoint_t *ep = malloc(sizeof(endpoint_t));
    85         if (ep == NULL)
     84        endpoint_t *ep = endpoint_get(
     85            address, endpoint, direction, type, speed, max_packet_size);
     86        if (!ep)
    8687                return ENOMEM;
    8788
    88         int ret = endpoint_init(ep, address, endpoint, direction, type, speed,
    89             max_packet_size);
    90         if (ret != EOK) {
    91                 free(ep);
    92                 return ret;
    93         }
    94 
    95         ret = usb_endpoint_manager_register_ep(instance, ep, data_size);
     89        const int ret =
     90            usb_endpoint_manager_register_ep(instance, ep, data_size);
    9691        if (ret != EOK) {
    9792                endpoint_destroy(ep);
    98                 return ret;
    9993        }
    100         return EOK;
     94        return ret;
    10195}
    10296#endif
Note: See TracChangeset for help on using the changeset viewer.