ata(4): Release the ioport resource if device initialization fails

PR:		251346
Submitted by:	janm@transactionware.com
MFC after:	1 week
This commit is contained in:
Mark Johnston 2020-11-24 17:13:08 +00:00
parent 78e1f68ee1
commit 938a9d7c4f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=367989

View file

@ -111,8 +111,12 @@ ata_pci_attach(device_t dev)
RF_ACTIVE);
}
if (ctlr->chipinit(dev))
if (ctlr->chipinit(dev)) {
if (ctlr->r_res1)
bus_release_resource(dev, ctlr->r_type1, ctlr->r_rid1,
ctlr->r_res1);
return ENXIO;
}
/* attach all channels on this controller */
for (unit = 0; unit < ctlr->channels; unit++) {