aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wilcox <matthew.r.wilcox@intel.com>2014-04-11 11:58:45 -0400
committerMatthew Wilcox <matthew.r.wilcox@intel.com>2014-05-05 10:41:25 -0400
commit27e8166c31656f7780e682eaf6bc9c3b8dd03253 (patch)
tree7954a4c32ccc89db93c34e195be69e034d8c2232
parent8757ad65d30f009fe0beeb2d70d3cd834cb998f2 (diff)
NVMe: Improve error messages
Help people diagnose what is going wrong at initialisation time by printing out which command has gone wrong and what the device returned. Also fix the error message printed while waiting for reset. Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com> Reviewed-by: Keith Busch <keith.busch@intel.com>
-rw-r--r--drivers/block/nvme-core.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
index eacd64e36be3..074e9829bb08 100644
--- a/drivers/block/nvme-core.c
+++ b/drivers/block/nvme-core.c
@@ -1354,7 +1354,8 @@ static int nvme_wait_ready(struct nvme_dev *dev, u64 cap, bool enabled)
1354 return -EINTR; 1354 return -EINTR;
1355 if (time_after(jiffies, timeout)) { 1355 if (time_after(jiffies, timeout)) {
1356 dev_err(&dev->pci_dev->dev, 1356 dev_err(&dev->pci_dev->dev,
1357 "Device not ready; aborting initialisation\n"); 1357 "Device not ready; aborting %s\n", enabled ?
1358 "initialisation" : "reset");
1358 return -ENODEV; 1359 return -ENODEV;
1359 } 1360 }
1360 } 1361 }
@@ -2058,8 +2059,13 @@ static int set_queue_count(struct nvme_dev *dev, int count)
2058 2059
2059 status = nvme_set_features(dev, NVME_FEAT_NUM_QUEUES, q_count, 0, 2060 status = nvme_set_features(dev, NVME_FEAT_NUM_QUEUES, q_count, 0,
2060 &result); 2061 &result);
2061 if (status) 2062 if (status < 0)
2062 return status < 0 ? -EIO : -EBUSY; 2063 return status;
2064 if (status > 0) {
2065 dev_err(&dev->pci_dev->dev, "Could not set queue count (%d)\n",
2066 status);
2067 return -EBUSY;
2068 }
2063 return min(result & 0xffff, result >> 16) + 1; 2069 return min(result & 0xffff, result >> 16) + 1;
2064} 2070}
2065 2071
@@ -2180,6 +2186,7 @@ static int nvme_dev_add(struct nvme_dev *dev)
2180 2186
2181 res = nvme_identify(dev, 0, 1, dma_addr); 2187 res = nvme_identify(dev, 0, 1, dma_addr);
2182 if (res) { 2188 if (res) {
2189 dev_err(&pdev->dev, "Identify Controller failed (%d)\n", res);
2183 res = -EIO; 2190 res = -EIO;
2184 goto out; 2191 goto out;
2185 } 2192 }