svn commit: r259866 - stable/10/sys/dev/ahci

Alexander Motin mav at FreeBSD.org
Wed Dec 25 12:41:54 UTC 2013


Author: mav
Date: Wed Dec 25 12:41:53 2013
New Revision: 259866
URL: http://svnweb.freebsd.org/changeset/base/259866

Log:
  MFC r259222:
  Destroy mtx lock when failed to allocate memory during attach.
  
  Submitted by:	Dmitry Luhtionov <dmitryluhtionov at gmail.com>

Modified:
  stable/10/sys/dev/ahci/ahciem.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/ahci/ahciem.c
==============================================================================
--- stable/10/sys/dev/ahci/ahciem.c	Wed Dec 25 09:43:51 2013	(r259865)
+++ stable/10/sys/dev/ahci/ahciem.c	Wed Dec 25 12:41:53 2013	(r259866)
@@ -85,8 +85,10 @@ ahci_em_attach(device_t dev)
 	mtx_init(&enc->mtx, "AHCI enclosure lock", NULL, MTX_DEF);
 	rid = 0;
 	if (!(enc->r_memc = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
-	    &rid, RF_ACTIVE)))
+	    &rid, RF_ACTIVE))) {
+		mtx_destroy(&enc->mtx);
 		return (ENXIO);
+	}
 	enc->capsem = ATA_INL(enc->r_memc, 0);
 	rid = 1;
 	if (!(enc->r_memt = bus_alloc_resource_any(dev, SYS_RES_MEMORY,


More information about the svn-src-all mailing list