Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 4a00bc9 in mainline


Ignore:
Timestamp:
2018-01-10T13:29:52Z (4 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master
Children:
398a94c
Parents:
f92f6b1
git-author:
Ondřej Hlavatý <aearsis@…> (2018-01-10 13:28:21)
git-committer:
Ondřej Hlavatý <aearsis@…> (2018-01-10 13:29:52)
Message:

xhci: fix errors reported by clang

Asserts were unnecessary, because the transfer type is an enum.
DMAMEM_4GiB is an uintptr_t constant.
There shall be at least one ring segment, and clang cannot infer that.
TRBs shall be 16-byte aligned to take aligned pointers from it.

Location:
uspace
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/xhci/endpoint.c

    rf92f6b1 r4a00bc9  
    429429
    430430        usb_transfer_type_t tt = ep->base.transfer_type;
    431         assert(tt < ARRAY_SIZE(setup_ep_ctx_helpers));
    432431
    433432        memset(ep_ctx, 0, sizeof(*ep_ctx));
  • uspace/drv/bus/usb/xhci/hw_struct/trb.h

    rf92f6b1 r4a00bc9  
    9696        xhci_dword_t status;
    9797        xhci_dword_t control;
    98 } __attribute__((packed)) xhci_trb_t;
     98} __attribute__((packed)) __attribute__((aligned(16))) xhci_trb_t;
    9999
    100100#define TRB_TYPE(trb)           XHCI_DWORD_EXTRACT((trb).control, 15, 10)
  • uspace/drv/bus/usb/xhci/transfers.c

    rf92f6b1 r4a00bc9  
    341341
    342342        const usb_transfer_type_t type = batch->ep->transfer_type;
    343         assert(type >= 0 && type < ARRAY_SIZE(transfer_handlers));
    344343        assert(transfer_handlers[type]);
    345344
  • uspace/drv/bus/usb/xhci/trb_ring.c

    rf92f6b1 r4a00bc9  
    151151        if (!next_segment)
    152152                next_segment = list_first(&ring->segments);
     153        assert(next_segment);
    153154
    154155        ring->enqueue_segment = list_get_instance(next_segment, trb_segment_t, segments_link);
     
    207208        xhci_trb_t *trb = first_trb;
    208209        for (size_t i = 0; i < trbs; ++i, ++trb) {
    209                 if (trb_generates_interrupt(trb)) {
     210                if (phys && trb_generates_interrupt(trb)) {
    210211                        if (*phys)
    211212                                return ENOTSUP;
  • uspace/lib/usbhost/src/dma_buffer.c

    rf92f6b1 r4a00bc9  
    6262        const size_t aligned_size = ALIGN_UP(size, policy.alignment);
    6363        const size_t real_size = ALIGN_UP(aligned_size, PAGE_SIZE);
    64         const int flags = policy.use64 ? 0 : DMAMEM_4GiB;
     64        const uintptr_t flags = policy.use64 ? 0 : DMAMEM_4GiB;
    6565
    6666        uintptr_t phys;
Note: See TracChangeset for help on using the changeset viewer.