Changeset 4d62aa0 in mainline for uspace/drv/bus/usb/ohci/ohci.c


Ignore:
Timestamp:
2011-07-10T23:03:54Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1ef93fa
Parents:
78ab6d4
Message:

OHCI: Cleanup error messages. Set driver data sooner.

File:
1 edited

Legend:

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

    r78ab6d4 r4d62aa0  
    167167        } \
    168168        free(instance); \
     169        device->driver_data = NULL; \
    169170        usb_log_error(message); \
    170171        return ret; \
     
    174175        instance->hc_fun = ddf_fun_create(device, fun_exposed, "ohci_hc");
    175176        int ret = instance->hc_fun ? EOK : ENOMEM;
    176         CHECK_RET_DEST_FREE_RETURN(ret, "Failed to create OHCI HC function.\n");
     177        CHECK_RET_DEST_FREE_RETURN(ret,
     178            "Failed to create OHCI HC function: %s.\n", str_error(ret));
    177179        instance->hc_fun->ops = &hc_ops;
    178180        instance->hc_fun->driver_data = &instance->hc;
     
    180182        instance->rh_fun = ddf_fun_create(device, fun_inner, "ohci_rh");
    181183        ret = instance->rh_fun ? EOK : ENOMEM;
    182         CHECK_RET_DEST_FREE_RETURN(ret, "Failed to create OHCI RH function.\n");
     184        CHECK_RET_DEST_FREE_RETURN(ret,
     185            "Failed to create OHCI RH function: %s.\n", str_error(ret));
    183186        instance->rh_fun->ops = &rh_ops;
    184187
     
    207210            &irq_code);
    208211        CHECK_RET_DEST_FREE_RETURN(ret,
    209             "Failed(%d) to register interrupt handler.\n", ret);
     212            "Failed to register interrupt handler: %s.\n", str_error(ret));
    210213
    211214        /* Try to enable interrupts */
     
    214217        if (ret != EOK) {
    215218                usb_log_warning("Failed to enable interrupts: %s."
    216                     "Falling back to pollling\n", str_error(ret));
     219                    "Falling back to polling\n", str_error(ret));
    217220                /* We don't need that handler */
    218221                unregister_interrupt_handler(device, irq);
     
    223226
    224227        ret = hc_init(&instance->hc, reg_base, reg_size, interrupts);
    225         CHECK_RET_DEST_FREE_RETURN(ret, "Failed(%d) to init ohci_hcd.\n", ret);
     228        CHECK_RET_DEST_FREE_RETURN(ret,
     229            "Failed to init ohci_hcd: %s.\n", str_error(ret));
     230
     231        device->driver_data = instance;
    226232
    227233#define CHECK_RET_FINI_RETURN(ret, message...) \
     
    235241        ret = ddf_fun_bind(instance->hc_fun);
    236242        CHECK_RET_FINI_RETURN(ret,
    237             "Failed(%d) to bind OHCI device function: %s.\n",
    238             ret, str_error(ret));
     243            "Failed to bind OHCI device function: %s.\n", str_error(ret));
    239244
    240245        ret = ddf_fun_add_to_class(instance->hc_fun, USB_HC_DDF_CLASS_NAME);
     
    242247            "Failed to add OHCI to HC class: %s.\n", str_error(ret));
    243248
    244         device->driver_data = instance;
    245 
    246249        hc_start_hw(&instance->hc);
    247250        hc_register_hub(&instance->hc, instance->rh_fun);
Note: See TracChangeset for help on using the changeset viewer.