Changeset e0d8b740 in mainline


Ignore:
Timestamp:
2013-08-07T08:26:40Z (11 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6340a6ff
Parents:
cce3228
Message:

uhci: remove some more error handling macros

Location:
uspace/drv/bus/usb/uhci
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/uhci/hc.c

    rcce3228 re0d8b740  
    208208{
    209209        assert(reg_size >= sizeof(uhci_regs_t));
    210         int ret;
    211 
    212 #define CHECK_RET_RETURN(ret, message...) \
    213         if (ret != EOK) { \
    214                 usb_log_error(message); \
    215                 return ret; \
    216         } else (void) 0
    217210
    218211        instance->hw_interrupts = interrupts;
     
    221214        /* allow access to hc control registers */
    222215        uhci_regs_t *io;
    223         ret = pio_enable(regs, reg_size, (void **)&io);
    224         CHECK_RET_RETURN(ret, "Failed to gain access to registers at %p: %s.\n",
    225             io, str_error(ret));
     216        int ret = pio_enable(regs, reg_size, (void **)&io);
     217        if (ret != EOK) {
     218                usb_log_error("Failed to gain access to registers at %p: %s.\n",
     219                    io, str_error(ret));
     220                return ret;
     221        }
    226222        instance->registers = io;
     223
    227224        usb_log_debug(
    228225            "Device registers at %p (%zuB) accessible.\n", io, reg_size);
    229226
    230227        ret = hc_init_mem_structures(instance);
    231         CHECK_RET_RETURN(ret,
    232             "Failed to initialize UHCI memory structures: %s.\n",
    233             str_error(ret));
    234 
    235 #undef CHECK_RET_RETURN
     228        if (ret != EOK) {
     229                usb_log_error("Failed to init UHCI memory structures: %s.\n",
     230                    str_error(ret));
     231                // TODO: we should disable pio here
     232                return ret;
     233        }
    236234
    237235        hc_init_hw(instance);
     
    391389
    392390        return EOK;
    393 #undef CHECK_RET_CLEAR_RETURN
    394391}
    395392
  • uspace/drv/bus/usb/uhci/res.c

    rcce3228 re0d8b740  
    6464        hw_res_list_parsed_t hw_res;
    6565        hw_res_list_parsed_init(&hw_res);
    66         const int ret =  hw_res_get_list_parsed(parent_sess, &hw_res, 0);
     66        const int ret = hw_res_get_list_parsed(parent_sess, &hw_res, 0);
    6767        async_hangup(parent_sess);
    6868        if (ret != EOK) {
  • uspace/drv/bus/usb/uhci/uhci.c

    rcce3228 re0d8b740  
    149149        hcd_set_implementation(dev_to_hcd(device), hc, hc_schedule, NULL, NULL);
    150150
    151 // TODO: Undo hcd_setup_device
    152 #define CHECK_RET_FINI_RETURN(ret, message...) \
    153 if (ret != EOK) { \
    154         hc_fini(hc); \
    155         CHECK_RET_RETURN(ret, message); \
    156         return ret; \
    157 } else (void)0
    158 
     151        /*
     152         * Creating root hub registers a new USB device so all HC
     153         * functionality needs to be ready at this time.
     154         */
    159155        ret = hcd_ddf_setup_root_hub(device, USB_SPEED_FULL);
    160         CHECK_RET_FINI_RETURN(ret,
    161             "Failed to setup UHCI root hub: %s.\n", str_error(ret));
     156        if (ret != EOK) {
     157                // TODO: Undo hcd_setup_device
     158                hc_fini(hc);
     159                CHECK_RET_RETURN(ret, "Failed to setup UHCI root hub: %s.\n",
     160                    str_error(ret));
     161                return ret;
     162        }
    162163
    163164        return EOK;
    164 #undef CHECK_RET_FINI_RETURN
    165165}
    166166/**
Note: See TracChangeset for help on using the changeset viewer.