Date: Wed, 11 Dec 2013 17:40:36 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r259222 - head/sys/dev/ahci Message-ID: <201312111740.rBBHeaOP073966@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Wed Dec 11 17:40:35 2013 New Revision: 259222 URL: http://svnweb.freebsd.org/changeset/base/259222 Log: Destroy mtx lock when failed to allocate memory during attach. Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com> MFC after: 2 weeks Modified: head/sys/dev/ahci/ahciem.c Modified: head/sys/dev/ahci/ahciem.c ============================================================================== --- head/sys/dev/ahci/ahciem.c Wed Dec 11 17:18:10 2013 (r259221) +++ head/sys/dev/ahci/ahciem.c Wed Dec 11 17:40:35 2013 (r259222) @@ -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,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201312111740.rBBHeaOP073966>