Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Nov 2020 17:13:09 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r367989 - head/sys/dev/ata
Message-ID:  <202011241713.0AOHD95h098431@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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@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++) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202011241713.0AOHD95h098431>