summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/nvme/nvme.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/dev/nvme/nvme.c b/sys/dev/nvme/nvme.c
index ec8d592..81c9087 100644
--- a/sys/dev/nvme/nvme.c
+++ b/sys/dev/nvme/nvme.c
@@ -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);
OpenPOWER on IntegriCloud