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


Ignore:
Timestamp:
2012-02-09T20:35:12Z (12 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
591762c6
Parents:
7cede12c (diff), 3d4750f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes

File:
1 edited

Legend:

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

    r7cede12c rb7068da  
    140140int device_setup_ohci(ddf_dev_t *device)
    141141{
    142         assert(device);
    143 
    144         ohci_t *instance = malloc(sizeof(ohci_t));
     142        if (device == NULL)
     143                return EBADMEM;
     144
     145        ohci_t *instance = ddf_dev_data_alloc(device,sizeof(ohci_t));
    145146        if (instance == NULL) {
    146147                usb_log_error("Failed to allocate OHCI driver.\n");
    147148                return ENOMEM;
    148149        }
    149         instance->rh_fun = NULL;
    150         instance->hc_fun = NULL;
    151150
    152151#define CHECK_RET_DEST_FREE_RETURN(ret, message...) \
    153152if (ret != EOK) { \
    154153        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; \
    158159                ddf_fun_destroy(instance->rh_fun); \
    159160        } \
    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 
    223221#define CHECK_RET_FINI_RETURN(ret, message...) \
    224222if (ret != EOK) { \
Note: See TracChangeset for help on using the changeset viewer.