svn commit: r256155 - head/sys/dev/nvme
Jim Harris
jimharris at FreeBSD.org
Tue Oct 8 16:01:44 UTC 2013
Author: jimharris
Date: Tue Oct 8 16:01:43 2013
New Revision: 256155
URL: http://svnweb.freebsd.org/changeset/base/256155
Log:
Do not leak resources during attach if nvme_ctrlr_construct() or the initial
controller resets fail.
Sponsored by: Intel
Reviewed by: carl
Approved by: re (hrs)
MFC after: 1 week
Modified:
head/sys/dev/nvme/nvme.c
Modified: head/sys/dev/nvme/nvme.c
==============================================================================
--- head/sys/dev/nvme/nvme.c Tue Oct 8 16:00:12 2013 (r256154)
+++ head/sys/dev/nvme/nvme.c Tue Oct 8 16:01:43 2013 (r256155)
@@ -221,8 +221,10 @@ nvme_attach(device_t dev)
status = nvme_ctrlr_construct(ctrlr, dev);
- if (status != 0)
+ if (status != 0) {
+ nvme_ctrlr_destruct(ctrlr, dev);
return (status);
+ }
/*
* Reset controller twice to ensure we do a transition from cc.en==1
@@ -230,12 +232,16 @@ nvme_attach(device_t dev)
* the controller was left in when boot handed off to OS.
*/
status = nvme_ctrlr_hw_reset(ctrlr);
- if (status != 0)
+ if (status != 0) {
+ nvme_ctrlr_destruct(ctrlr, dev);
return (status);
+ }
status = nvme_ctrlr_hw_reset(ctrlr);
- if (status != 0)
+ if (status != 0) {
+ nvme_ctrlr_destruct(ctrlr, dev);
return (status);
+ }
nvme_sysctl_initialize_ctrlr(ctrlr);
More information about the svn-src-all
mailing list