Changeset e67c50a in mainline for uspace/drv/bus/usb/ohci/ohci_bus.c
- Timestamp:
- 2018-02-01T21:13:23Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 64ce0c1
- Parents:
- 3e6ff9a
- git-author:
- Ondřej Hlavatý <aearsis@…> (2018-02-01 21:13:22)
- git-committer:
- Ondřej Hlavatý <aearsis@…> (2018-02-01 21:13:23)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ohci/ohci_bus.c
r3e6ff9a re67c50a 75 75 assert(dev); 76 76 77 ohci_endpoint_t *ohci_ep = malloc(sizeof(ohci_endpoint_t));77 ohci_endpoint_t *ohci_ep = calloc(1, sizeof(ohci_endpoint_t)); 78 78 if (ohci_ep == NULL) 79 79 return NULL; … … 81 81 endpoint_init(&ohci_ep->base, dev, desc); 82 82 83 ohci_ep->ed = malloc32(sizeof(ed_t));84 if ( ohci_ep->ed == NULL) {83 const errno_t err = dma_buffer_alloc(&ohci_ep->dma_buffer, sizeof(ed_t) + 2 * sizeof(td_t)); 84 if (err) { 85 85 free(ohci_ep); 86 86 return NULL; 87 87 } 88 88 89 ohci_ep->td = malloc32(sizeof(td_t)); 90 if (ohci_ep->td == NULL) { 91 free32(ohci_ep->ed); 92 free(ohci_ep); 93 return NULL; 94 } 89 ohci_ep->ed = ohci_ep->dma_buffer.virt; 90 91 ohci_ep->tds[0] = (td_t *) ohci_ep->ed + 1; 92 ohci_ep->tds[1] = ohci_ep->tds[0] + 1; 95 93 96 94 link_initialize(&ohci_ep->eplist_link); … … 109 107 ohci_endpoint_t *instance = ohci_endpoint_get(ep); 110 108 111 free32(instance->ed); 112 free32(instance->td); 109 dma_buffer_free(&instance->dma_buffer); 113 110 free(instance); 114 111 } … … 125 122 return err; 126 123 127 ed_init(ohci_ep->ed, ep, ohci_ep->td );124 ed_init(ohci_ep->ed, ep, ohci_ep->tds[0]); 128 125 hc_enqueue_endpoint(bus->hc, ep); 129 126 endpoint_set_online(ep, &bus->hc->guard);
Note:
See TracChangeset
for help on using the changeset viewer.