Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ata/src/ata.c

    r0dab4850 r743f2cdd  
    11/*
    2  * Copyright (c) 2025 Jiri Svoboda
     2 * Copyright (c) 2024 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    151151{
    152152        ata_channel_t *chan;
    153         int i;
    154153
    155154        chan = calloc(1, sizeof(ata_channel_t));
     
    163162        fibril_mutex_initialize(&chan->irq_lock);
    164163        fibril_condvar_initialize(&chan->irq_cv);
    165 
    166         for (i = 0; i < MAX_DEVICES; i++)
    167                 chan->device[i].chan = chan;
    168164
    169165        *rchan = chan;
     
    257253
    258254        for (i = 0; i < MAX_DEVICES; i++) {
    259                 if (chan->device[i].present == false)
    260                         continue;
    261 
    262255                rc = ata_device_remove(&chan->device[i]);
    263256                if (rc != EOK) {
    264257                        ata_msg_error(chan, "Unable to remove device %d.", i);
    265                         fibril_mutex_unlock(&chan->lock);
    266258                        return rc;
    267259                }
     
    270262        ata_bd_fini_irq(chan);
    271263        fibril_mutex_unlock(&chan->lock);
    272         free(chan);
    273 
    274         return rc;
     264
     265        return EOK;
    275266}
    276267
     
    502493        unsigned i;
    503494
     495        d->chan = chan;
    504496        d->device_id = device_id;
    505497        d->present = false;
     
    15371529         * exceed DMA buffer size.
    15381530         */
    1539         if (d->chan->params.use_dma) {
    1540                 dma_maxnb = d->chan->params.max_dma_xfer / d->block_size;
    1541                 if (dma_maxnb < maxnb)
    1542                         maxnb = dma_maxnb;
    1543         }
     1531        dma_maxnb = d->chan->params.max_dma_xfer / d->block_size;
     1532        if (dma_maxnb < maxnb)
     1533                maxnb = dma_maxnb;
    15441534
    15451535        return maxnb;
Note: See TracChangeset for help on using the changeset viewer.