Remember to mtx_destroy mutexes.
This commit is contained in:
parent
2298a6e766
commit
e7c9858a8f
@ -123,9 +123,6 @@ ata_probe(device_t dev)
|
||||
ch->device[SLAVE].mode = ATA_PIO;
|
||||
ch->dev = dev;
|
||||
ch->state = ATA_IDLE;
|
||||
bzero(&ch->queue_mtx, sizeof(struct mtx));
|
||||
mtx_init(&ch->queue_mtx, "ATA queue lock", MTX_DEF, 0);
|
||||
TAILQ_INIT(&ch->ata_queue);
|
||||
|
||||
/* initialise device(s) on this channel */
|
||||
ch->locking(ch, ATA_LF_LOCK);
|
||||
@ -159,6 +156,11 @@ ata_attach(device_t dev)
|
||||
if (ch->dma)
|
||||
ch->dma->alloc(ch);
|
||||
|
||||
/* initialize queue and associated lock */
|
||||
bzero(&ch->queue_mtx, sizeof(struct mtx));
|
||||
mtx_init(&ch->queue_mtx, "ATA queue lock", MTX_DEF, 0);
|
||||
TAILQ_INIT(&ch->ata_queue);
|
||||
|
||||
/* do not attach devices if we are in early boot */
|
||||
if (ata_delayed_attach)
|
||||
return 0;
|
||||
@ -220,6 +222,7 @@ ata_detach(device_t dev)
|
||||
bus_teardown_intr(dev, ch->r_irq, ch->ih);
|
||||
bus_release_resource(dev, SYS_RES_IRQ, ATA_IRQ_RID, ch->r_irq);
|
||||
ch->r_irq = NULL;
|
||||
mtx_destroy(&ch->queue_mtx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -169,6 +169,7 @@ ad_detach(struct ata_device *atadev)
|
||||
mtx_lock(&adp->queue_mtx);
|
||||
bioq_flush(&adp->queue, NULL, ENXIO);
|
||||
mtx_unlock(&adp->queue_mtx);
|
||||
mtx_destroy(&adp->queue_mtx);
|
||||
disk_destroy(adp->disk);
|
||||
ata_prtdev(atadev, "WARNING - removed from configuration\n");
|
||||
ata_free_name(atadev);
|
||||
|
@ -204,6 +204,7 @@ acd_detach(struct ata_device *atadev)
|
||||
mtx_lock(&cdp->queue_mtx);
|
||||
bioq_flush(&cdp->queue, NULL, ENXIO);
|
||||
mtx_unlock(&cdp->queue_mtx);
|
||||
mtx_destroy(&cdp->queue_mtx);
|
||||
ata_prtdev(atadev, "WARNING - removed from configuration\n");
|
||||
ata_free_name(atadev);
|
||||
ata_free_lun(&acd_lun_map, cdp->lun);
|
||||
|
@ -124,6 +124,7 @@ afd_detach(struct ata_device *atadev)
|
||||
mtx_lock(&fdp->queue_mtx);
|
||||
bioq_flush(&fdp->queue, NULL, ENXIO);
|
||||
mtx_unlock(&fdp->queue_mtx);
|
||||
mtx_destroy(&fdp->queue_mtx);
|
||||
disk_destroy(fdp->disk);
|
||||
ata_prtdev(atadev, "WARNING - removed from configuration\n");
|
||||
ata_free_name(atadev);
|
||||
|
@ -169,6 +169,7 @@ ast_detach(struct ata_device *atadev)
|
||||
mtx_lock(&stp->queue_mtx);
|
||||
bioq_flush(&stp->queue, NULL, ENXIO);
|
||||
mtx_unlock(&stp->queue_mtx);
|
||||
mtx_destroy(&stp->queue_mtx);
|
||||
destroy_dev(stp->dev1);
|
||||
destroy_dev(stp->dev2);
|
||||
devstat_remove_entry(stp->stats);
|
||||
|
Loading…
x
Reference in New Issue
Block a user