Changeset 1664a26 in mainline for uspace/drv/bus/usb/uhci/uhci.c


Ignore:
Timestamp:
2011-12-09T22:40:34Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
266976f
Parents:
89e061d
Message:

uhci: Prefer ddf_dev_data_alloc to plain malloc.

File:
1 edited

Legend:

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

    r89e061d r1664a26  
    148148int device_setup_uhci(ddf_dev_t *device)
    149149{
    150         assert(device);
    151         uhci_t *instance = malloc(sizeof(uhci_t));
     150        if (!device)
     151                return EBADMEM;
     152
     153        uhci_t *instance = ddf_dev_data_alloc(device, sizeof(uhci_t));
    152154        if (instance == NULL) {
    153155                usb_log_error("Failed to allocate OHCI driver.\n");
     
    158160if (ret != EOK) { \
    159161        if (instance->hc_fun) \
    160                 instance->hc_fun->ops = NULL; \
    161162                instance->hc_fun->driver_data = NULL; \
    162163                ddf_fun_destroy(instance->hc_fun); \
    163164        if (instance->rh_fun) {\
    164                 instance->rh_fun->ops = NULL; \
    165165                instance->rh_fun->driver_data = NULL; \
    166166                ddf_fun_destroy(instance->rh_fun); \
    167167        } \
    168         device->driver_data = NULL; \
    169168        usb_log_error(message); \
    170169        return ret; \
     
    227226            "Failed to init uhci_hcd: %s.\n", str_error(ret));
    228227
    229         device->driver_data = instance;
    230 
    231228#define CHECK_RET_FINI_RETURN(ret, message...) \
    232229if (ret != EOK) { \
Note: See TracChangeset for help on using the changeset viewer.