MFC r259222:

Destroy mtx lock when failed to allocate memory during attach.

Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
This commit is contained in:
mav 2013-12-25 12:41:53 +00:00
parent d3ac080f01
commit 440a3e9f89

View File

@ -85,8 +85,10 @@ ahci_em_attach(device_t dev)
mtx_init(&enc->mtx, "AHCI enclosure lock", NULL, MTX_DEF);
rid = 0;
if (!(enc->r_memc = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
&rid, RF_ACTIVE)))
&rid, RF_ACTIVE))) {
mtx_destroy(&enc->mtx);
return (ENXIO);
}
enc->capsem = ATA_INL(enc->r_memc, 0);
rid = 1;
if (!(enc->r_memt = bus_alloc_resource_any(dev, SYS_RES_MEMORY,