Changeset cffa14e6 in mainline for uspace/drv/bus/usb/uhcirh/main.c


Ignore:
Timestamp:
2013-07-24T17:27:56Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
db71e2a
Parents:
c442f63
Message:

revert usb hc macro changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/uhcirh/main.c

    rc442f63 rcffa14e6  
    9393        size_t io_size = 0;
    9494        uhci_root_hub_t *rh = NULL;
    95         int rc;
     95        int ret = EOK;
    9696
    97         rc = hc_get_my_registers(device, &io_regs, &io_size);
    98         if (rc != EOK) {
    99                 usb_log_error( "Failed to get registers from HC: %s.\n",
    100                     str_error(rc));
    101                 return rc;
    102         }
     97#define CHECK_RET_FREE_RH_RETURN(ret, message...) \
     98if (ret != EOK) { \
     99        usb_log_error(message); \
     100        return ret; \
     101} else (void)0
    103102
     103        ret = hc_get_my_registers(device, &io_regs, &io_size);
     104        CHECK_RET_FREE_RH_RETURN(ret,
     105            "Failed to get registers from HC: %s.\n", str_error(ret));
    104106        usb_log_debug("I/O regs at %p (size %zuB).\n",
    105107            (void *) io_regs, io_size);
    106108
    107109        rh = ddf_dev_data_alloc(device, sizeof(uhci_root_hub_t));
    108         if (rh == NULL) {
    109                 usb_log_error("Failed to allocate rh driver instance.\n");
    110                 return ENOMEM;
    111         }
     110        ret = (rh == NULL) ? ENOMEM : EOK;
     111        CHECK_RET_FREE_RH_RETURN(ret,
     112            "Failed to allocate rh driver instance.\n");
    112113
    113         rc = uhci_root_hub_init(rh, (void*)io_regs, io_size, device);
    114         if (rc != EOK) {
    115                 usb_log_error("Failed(%d) to initialize rh driver instance: "
    116                     "%s.\n", rc, str_error(rc));
    117                 return rc;
    118         }
     114        ret = uhci_root_hub_init(rh, (void*)io_regs, io_size, device);
     115        CHECK_RET_FREE_RH_RETURN(ret,
     116            "Failed(%d) to initialize rh driver instance: %s.\n",
     117            ret, str_error(ret));
    119118
    120119        usb_log_info("Controlling root hub '%s' (%" PRIun ").\n",
    121120            ddf_dev_get_name(device), ddf_dev_get_handle(device));
    122 
    123121        return EOK;
    124122}
Note: See TracChangeset for help on using the changeset viewer.