Changeset 5ec492b in mainline


Ignore:
Timestamp:
2011-09-07T14:09:07Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ffe3fe1
Parents:
d394f1b8
Message:

ohci: Fix error paths

Location:
uspace/drv/bus/usb/ohci
Files:
2 edited

Legend:

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

    rd394f1b8 r5ec492b  
    139139            &instance->generic.dev_manager, hub_address, hub_fun->handle);
    140140
    141 #define CHECK_RET_RETURN(ret, message...) \
     141#define CHECK_RET_UNREG_RETURN(ret, message...) \
    142142if (ret != EOK) { \
    143143        usb_log_error(message); \
     144        usb_endpoint_manager_unregister_ep( \
     145            &instance->generic.ep_manager, hub_address, 0, USB_DIRECTION_BOTH);\
     146        usb_device_keeper_release( \
     147            &instance->generic.dev_manager, hub_address); \
    144148        return ret; \
    145149} else (void)0
     
    147151            &instance->generic.ep_manager, hub_address, 0, USB_DIRECTION_BOTH,
    148152            USB_TRANSFER_CONTROL, USB_SPEED_FULL, 64, 0);
    149         CHECK_RET_RETURN(ret,
     153        CHECK_RET_UNREG_RETURN(ret,
    150154            "Failed to register root hub control endpoint: %s.\n",
    151155            str_error(ret));
    152156
    153157        ret = ddf_fun_add_match_id(hub_fun, "usb&class=hub", 100);
    154         CHECK_RET_RETURN(ret,
     158        CHECK_RET_UNREG_RETURN(ret,
    155159            "Failed to add root hub match-id: %s.\n", str_error(ret));
    156160
    157161        ret = ddf_fun_bind(hub_fun);
    158         CHECK_RET_RETURN(ret,
     162        CHECK_RET_UNREG_RETURN(ret,
    159163            "Failed to bind root hub function: %s.\n", str_error(ret));
    160164
  • uspace/drv/bus/usb/ohci/ohci.c

    rd394f1b8 r5ec492b  
    231231#define CHECK_RET_FINI_RETURN(ret, message...) \
    232232if (ret != EOK) { \
     233        hc_fini(&instance->hc); \
    233234        unregister_interrupt_handler(device, irq); \
    234         hc_fini(&instance->hc); \
    235235        CHECK_RET_DEST_FREE_RETURN(ret, message); \
    236236} else (void)0
     
    245245            "Failed to add OHCI to HC class: %s.\n", str_error(ret));
    246246
    247         hc_register_hub(&instance->hc, instance->rh_fun);
    248         return EOK;
     247        ret = hc_register_hub(&instance->hc, instance->rh_fun);
     248        CHECK_RET_FINI_RETURN(ret,
     249            "Failed to register OHCI root hub: %s.\n", str_error(ret));
     250        return ret;
    249251
    250252#undef CHECK_RET_FINI_RETURN
Note: See TracChangeset for help on using the changeset viewer.