svn commit: r367989 - head/sys/dev/ata

Mark Johnston markj at FreeBSD.org
Tue Nov 24 17:13:09 UTC 2020


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:	janm at 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++) {


More information about the svn-src-head mailing list