Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/usbmast/main.c

    r2aceec5 r5f6e25e  
    145145        usbmast_fun_t *mfun = NULL;
    146146
    147         /* Allocate softstate */
    148         mfun = calloc(1, sizeof(usbmast_fun_t));
    149         if (mfun == NULL) {
    150                 usb_log_error("Failed allocating softstate.\n");
    151                 rc = ENOMEM;
    152                 goto error;
    153         }
    154 
    155         mfun->mdev = mdev;
    156         mfun->lun = lun;
    157 
    158147        if (asprintf(&fun_name, "l%u", lun) < 0) {
    159148                usb_log_error("Out of memory.\n");
     
    170159
    171160        free(fun_name);
     161
     162        /* Allocate soft state */
     163        mfun = ddf_dev_data_alloc(mdev->ddf_dev, sizeof(usbmast_fun_t));
     164        if (mfun == NULL) {
     165                usb_log_error("Failed allocating softstate.\n");
     166                rc = ENOMEM;
     167                goto error;
     168        }
     169
     170        mfun->mdev = mdev;
     171        mfun->lun = lun;
     172
    172173        fun_name = NULL;
    173174
     
    227228        if (fun_name != NULL)
    228229                free(fun_name);
    229         if (mfun != NULL)
    230                 free(mfun);
    231230        return rc;
    232231}
Note: See TracChangeset for help on using the changeset viewer.