Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: keith.busch@intel.com (Keith Busch)
Subject: [PATCH 3/6] nvme-pci: Queue creation fixes
Date: Wed,  6 Jun 2018 08:13:06 -0600	[thread overview]
Message-ID: <20180606141309.19389-4-keith.busch@intel.com> (raw)
In-Reply-To: <20180606141309.19389-1-keith.busch@intel.com>

We've been ignoring NVMe error status on queue creations. Fortunately they
are uncommon, but we should handle these anyway. This patch adds checks
for the a positive error return value that indicates an NVMe status.

If we do see a negative return, the controller isn't usable, so this
patch returns immediately in since we can't unwind that failure.

Signed-off-by: Keith Busch <keith.busch at intel.com>
---
 drivers/nvme/host/pci.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 94d9abbe2d45..ed9fac721b8c 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1466,11 +1466,13 @@ static int nvme_create_queue(struct nvme_queue *nvmeq, int qid)
 	 */
 	vector = dev->num_vecs == 1 ? 0 : qid;
 	result = adapter_alloc_cq(dev, qid, nvmeq, vector);
-	if (result < 0)
-		goto out;
+	if (result)
+		return result;
 
 	result = adapter_alloc_sq(dev, qid, nvmeq);
 	if (result < 0)
+		return result;
+	else if (result)
 		goto release_cq;
 
 	/*
@@ -1492,7 +1494,6 @@ static int nvme_create_queue(struct nvme_queue *nvmeq, int qid)
 	adapter_delete_sq(dev, qid);
 release_cq:
 	adapter_delete_cq(dev, qid);
-out:
 	return result;
 }
 
-- 
2.14.3

  parent reply	other threads:[~2018-06-06 14:13 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-06 14:13 [PATCH 0/6] minor nvme fixes for 4.18 Keith Busch
2018-06-06 14:13 ` [PATCH 1/6] nvme-pci: Remove unnecessary nested locking Keith Busch
2018-06-06 14:19   ` Jens Axboe
2018-06-07  7:16   ` Johannes Thumshirn
2018-06-07  8:43   ` Sagi Grimberg
2018-06-06 14:13 ` [PATCH 2/6] nvme-pci: Remove unnecessary completion doorbell check Keith Busch
2018-06-06 14:19   ` Jens Axboe
2018-06-07  7:16   ` Johannes Thumshirn
2018-06-07  8:44   ` Sagi Grimberg
2018-06-06 14:13 ` Keith Busch [this message]
2018-06-06 14:59   ` [PATCH 3/6] nvme-pci: Queue creation fixes Jens Axboe
2018-06-07  7:17   ` Johannes Thumshirn
2018-06-07  8:45   ` Sagi Grimberg
2018-06-06 14:13 ` [PATCH 4/6] nvme-pci: Remove HMB teardown on reset Keith Busch
2018-06-07  7:17   ` Johannes Thumshirn
2018-06-07  8:46   ` Sagi Grimberg
2018-06-07 14:27     ` Keith Busch
2018-06-06 14:13 ` [PATCH 5/6] nvme-pci: Unquiesce dead controller queues Keith Busch
2018-06-07  7:19   ` Johannes Thumshirn
2018-06-07  8:47   ` Sagi Grimberg
2018-06-06 14:13 ` [PATCH 6/6] nvme-pci: Make CMB SQ mod-param read-only Keith Busch
2018-06-07  7:19   ` Johannes Thumshirn
2018-06-07 14:29     ` Keith Busch
2018-06-07  8:48   ` Sagi Grimberg
2018-06-06 14:43 ` [PATCH 0/6] minor nvme fixes for 4.18 Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180606141309.19389-4-keith.busch@intel.com \
    --to=keith.busch@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox