Commit 27e8166c authored by Matthew Wilcox's avatar Matthew Wilcox

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: default avatarMatthew Wilcox <matthew.r.wilcox@intel.com>
Reviewed-by: default avatarKeith Busch <keith.busch@intel.com>
parent 8757ad65
...@@ -1354,7 +1354,8 @@ static int nvme_wait_ready(struct nvme_dev *dev, u64 cap, bool enabled) ...@@ -1354,7 +1354,8 @@ static int nvme_wait_ready(struct nvme_dev *dev, u64 cap, bool enabled)
return -EINTR; return -EINTR;
if (time_after(jiffies, timeout)) { if (time_after(jiffies, timeout)) {
dev_err(&dev->pci_dev->dev, dev_err(&dev->pci_dev->dev,
"Device not ready; aborting initialisation\n"); "Device not ready; aborting %s\n", enabled ?
"initialisation" : "reset");
return -ENODEV; return -ENODEV;
} }
} }
...@@ -2058,8 +2059,13 @@ static int set_queue_count(struct nvme_dev *dev, int count) ...@@ -2058,8 +2059,13 @@ static int set_queue_count(struct nvme_dev *dev, int count)
status = nvme_set_features(dev, NVME_FEAT_NUM_QUEUES, q_count, 0, status = nvme_set_features(dev, NVME_FEAT_NUM_QUEUES, q_count, 0,
&result); &result);
if (status) if (status < 0)
return status < 0 ? -EIO : -EBUSY; return status;
if (status > 0) {
dev_err(&dev->pci_dev->dev, "Could not set queue count (%d)\n",
status);
return -EBUSY;
}
return min(result & 0xffff, result >> 16) + 1; return min(result & 0xffff, result >> 16) + 1;
} }
...@@ -2180,6 +2186,7 @@ static int nvme_dev_add(struct nvme_dev *dev) ...@@ -2180,6 +2186,7 @@ static int nvme_dev_add(struct nvme_dev *dev)
res = nvme_identify(dev, 0, 1, dma_addr); res = nvme_identify(dev, 0, 1, dma_addr);
if (res) { if (res) {
dev_err(&pdev->dev, "Identify Controller failed (%d)\n", res);
res = -EIO; res = -EIO;
goto out; goto out;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment