Ignore:
File:
1 edited

Legend:

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

    r9c986d3 r27ed734c  
    140140int device_setup_ohci(ddf_dev_t *device)
    141141{
    142         if (device == NULL)
    143                 return EBADMEM;
    144 
    145         ohci_t *instance = ddf_dev_data_alloc(device,sizeof(ohci_t));
     142        assert(device);
     143
     144        ohci_t *instance = malloc(sizeof(ohci_t));
    146145        if (instance == NULL) {
    147146                usb_log_error("Failed to allocate OHCI driver.\n");
    148147                return ENOMEM;
    149148        }
     149        instance->rh_fun = NULL;
     150        instance->hc_fun = NULL;
    150151
    151152#define CHECK_RET_DEST_FREE_RETURN(ret, message...) \
    152153if (ret != EOK) { \
    153154        if (instance->hc_fun) { \
    154                 instance->hc_fun->driver_data = NULL; \
    155155                ddf_fun_destroy(instance->hc_fun); \
    156156        } \
    157157        if (instance->rh_fun) { \
    158                 instance->rh_fun->driver_data = NULL; \
    159158                ddf_fun_destroy(instance->rh_fun); \
    160159        } \
     160        free(instance); \
    161161        usb_log_error(message); \
    162162        return ret; \
     
    219219            "Failed to init ohci_hcd: %s.\n", str_error(ret));
    220220
     221        device->driver_data = instance;
     222
    221223#define CHECK_RET_FINI_RETURN(ret, message...) \
    222224if (ret != EOK) { \
Note: See TracChangeset for help on using the changeset viewer.