Changeset aa81adc in mainline for uspace/drv/bus/usb/ohci/hc.c


Ignore:
Timestamp:
2011-07-11T09:28:00Z (14 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/drv/bus/usb/ohci/hc.c

    r1cb4f05 raa81adc  
    235235    size_t mps, size_t size, unsigned interval)
    236236{
    237         endpoint_t *ep = malloc(sizeof(endpoint_t));
     237        endpoint_t *ep =
     238            endpoint_get(address, endpoint, direction, type, speed, mps);
    238239        if (ep == NULL)
    239240                return ENOMEM;
    240         int ret =
    241             endpoint_init(ep, address, endpoint, direction, type, speed, mps);
    242         if (ret != EOK) {
    243                 free(ep);
    244                 return ret;
    245         }
    246241
    247242        hcd_endpoint_t *hcd_ep = hcd_endpoint_assign(ep);
     
    251246        }
    252247
    253         ret = usb_endpoint_manager_register_ep(&instance->ep_manager, ep, size);
     248        int ret =
     249            usb_endpoint_manager_register_ep(&instance->ep_manager, ep, size);
    254250        if (ret != EOK) {
    255251                hcd_endpoint_clear(ep);
     
    279275                    &instance->lists[ep->transfer_type], hcd_ep);
    280276                instance->registers->control |= C_PLE | C_IE;
    281                 break;
    282         default:
    283277                break;
    284278        }
Note: See TracChangeset for help on using the changeset viewer.