Changeset 46d12fb in mainline


Ignore:
Timestamp:
2011-03-18T21:27:19Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
eedac04
Parents:
171cd88
Message:

Refactoring

Don't call addr_to_phys syscall on NULL pointer.

Location:
uspace/drv/uhci-hcd
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/uhci-hcd/uhci_struct/transfer_descriptor.c

    r171cd88 r46d12fb  
    6969            || (pid == USB_PID_OUT));
    7070
     71        const uint32_t next_pa = addr_to_phys(next);
     72        assert((next_pa & LINK_POINTER_ADDRESS_MASK) == next_pa);
     73
    7174        instance->next = 0
    7275            | LINK_POINTER_VERTICAL_FLAG
    73             | ((next != NULL) ? addr_to_phys(next) : LINK_POINTER_TERMINATE_FLAG);
     76            | (next_pa ? next_pa : LINK_POINTER_TERMINATE_FLAG);
    7477
    7578        instance->status = 0
     
    9093            | ((pid & TD_DEVICE_PID_MASK) << TD_DEVICE_PID_POS);
    9194
    92         instance->buffer_ptr = 0;
    93 
    94         if (size) {
    95                 instance->buffer_ptr = (uintptr_t)addr_to_phys(buffer);
    96         }
     95        instance->buffer_ptr = addr_to_phys(buffer);
    9796
    9897        usb_log_debug2("Created TD(%p): %X:%X:%X:%X(%p).\n",
  • uspace/drv/uhci-hcd/utils/malloc32.h

    r171cd88 r46d12fb  
    5050static inline uintptr_t addr_to_phys(void *addr)
    5151{
     52        if (addr == NULL)
     53                return 0;
     54
    5255        uintptr_t result;
    5356        int ret = as_get_physical_mapping(addr, &result);
Note: See TracChangeset for help on using the changeset viewer.