handles more exceptional cases when the driver failed to attach.

MFC after:	3 days
This commit is contained in:
Weongyo Jeong 2009-03-30 08:48:33 +00:00
parent 2b0b4ee359
commit df1af10875

View File

@ -260,12 +260,13 @@ malo_pci_attach(device_t dev)
error = malo_attach(pci_get_device(dev), sc);
if (error != 0) {
malo_pci_detach(dev);
return (error);
}
if (error != 0)
goto bad2;
return (error);
bad2:
bus_dma_tag_destroy(sc->malo_dmat);
bad1:
if (psc->malo_msi == 0)
bus_teardown_intr(dev, psc->malo_res_irq[0],
@ -275,10 +276,11 @@ malo_pci_attach(device_t dev)
bus_teardown_intr(dev, psc->malo_res_irq[i],
psc->malo_intrhand[i]);
}
bus_release_resources(dev, psc->malo_irq_spec, psc->malo_res_irq);
bad:
if (psc->malo_msi != 0)
pci_release_msi(dev);
bus_release_resources(dev, psc->malo_mem_spec, psc->malo_res_mem);
return (error);
}