Author: markj
Date: Tue Nov 24 17:13:08 2020
New Revision: 367989
URL: https://svnweb.freebsd.org/changeset/base/367989

Log:
  ata(4): Release the ioport resource if device initialization fails
  
  PR:           251346
  Submitted by: j...@transactionware.com
  MFC after:    1 week

Modified:
  head/sys/dev/ata/ata-pci.c

Modified: head/sys/dev/ata/ata-pci.c
==============================================================================
--- head/sys/dev/ata/ata-pci.c  Tue Nov 24 17:12:40 2020        (r367988)
+++ head/sys/dev/ata/ata-pci.c  Tue Nov 24 17:13:08 2020        (r367989)
@@ -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++) {
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to