Changeset 87037cc9 in mainline for uspace/drv/bus/usb/usbmast/main.c


Ignore:
Timestamp:
2011-10-14T12:05:40Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3002434
Parents:
a92ce4ef
Message:

usbmast: Keep track of pointers to created LUN functions.

File:
1 edited

Legend:

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

    ra92ce4ef r87037cc9  
    112112
    113113        usb_log_debug("Get LUN count...\n");
    114         mdev->luns = usb_masstor_get_lun_count(mdev);
    115 
    116         for (i = 0; i < mdev->luns; i++) {
     114        mdev->lun_count = usb_masstor_get_lun_count(mdev);
     115        mdev->luns = calloc(mdev->lun_count, sizeof(ddf_fun_t*));
     116        if (mdev->luns == NULL) {
     117                rc = ENOMEM;
     118                usb_log_error("Failed allocating luns table.\n");
     119                goto error;
     120        }
     121
     122        for (i = 0; i < mdev->lun_count; i++) {
    117123                rc = usbmast_fun_create(mdev, i);
    118124                if (rc != EOK)
     
    162168        }
    163169
     170        mfun->ddf_fun = fun;
    164171        mfun->mdev = mdev;
    165172        mfun->lun = lun;
     
    212219
    213220        free(fun_name);
     221        mdev->luns[lun] = fun;
    214222
    215223        return EOK;
Note: See TracChangeset for help on using the changeset viewer.