Changeset 5af21c5 in mainline for uspace/lib/libdrv/generic/driver.c


Ignore:
Timestamp:
2010-04-23T13:40:39Z (14 years ago)
Author:
Lenka Trochtova <trochtova.lenka@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
953bc1ef
Parents:
df747b9c
Message:

fixed a bug

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/libdrv/generic/driver.c

    rdf747b9c r5af21c5  
    5959FIBRIL_MUTEX_INITIALIZE(devices_mutex);
    6060
    61 static device_t * driver_create_device()
    62 {
    63         device_t *dev = (device_t *)malloc(sizeof(device_t));
    64         if (NULL != dev) {
    65                 memset(dev, 0, sizeof(device_t));
    66         }
    67         return dev;
    68 }
    69 
    7061static void add_to_devices_list(device_t *dev)
    7162{
     
    7869{
    7970        fibril_mutex_lock(&devices_mutex);
    80         list_append(&dev->link, &devices);
     71        list_remove(&dev->link);
    8172        fibril_mutex_unlock(&devices_mutex);
    8273}
     
    10798       
    10899        device_handle_t dev_handle =  IPC_GET_ARG1(*icall);
    109         device_t *dev = driver_create_device();
     100        device_t *dev = create_device();
    110101        dev->handle = dev_handle;
    111102       
     
    120111                printf("%s: failed to add a new device with handle = %d.\n", driver->name, dev_handle);
    121112                remove_from_devices_list(dev);
    122                 delete_device(dev);            
     113                delete_device(dev);     
    123114        }
    124115       
Note: See TracChangeset for help on using the changeset viewer.