Commit 422ef0c7 authored by Matthew Wilcox's avatar Matthew Wilcox

NVMe: Don't fail initialisation unnecessarily

The nvme_dev_add() function currently returns the last error code that it
saw, which (if everything else succeeds) happens to be the result of an
optional command, so it can legitimately fail.  Looking at the error path
more closely reveals that we should return success from this function,
even if no device namespaces are added.  So once the queues are created
and the device has responded to Identify, make sure that this function
succeeds.
Signed-off-by: default avatarMatthew Wilcox <matthew.r.wilcox@intel.com>
Acked-by: default avatarKeith Busch <keith.busch@intel.com>
parent 063cc6d5
...@@ -1502,6 +1502,12 @@ static void nvme_free_queues(struct nvme_dev *dev) ...@@ -1502,6 +1502,12 @@ static void nvme_free_queues(struct nvme_dev *dev)
nvme_free_queue(dev, i); nvme_free_queue(dev, i);
} }
/*
* Return: error value if an error occurred setting up the queues or calling
* Identify Device. 0 if these succeeded, even if adding some of the
* namespaces failed. At the moment, these failures are silent. TBD which
* failures should be reported.
*/
static int nvme_dev_add(struct nvme_dev *dev) static int nvme_dev_add(struct nvme_dev *dev)
{ {
int res, nn, i; int res, nn, i;
...@@ -1555,7 +1561,7 @@ static int nvme_dev_add(struct nvme_dev *dev) ...@@ -1555,7 +1561,7 @@ static int nvme_dev_add(struct nvme_dev *dev)
} }
list_for_each_entry(ns, &dev->namespaces, list) list_for_each_entry(ns, &dev->namespaces, list)
add_disk(ns->disk); add_disk(ns->disk);
res = 0;
goto out; goto out;
out_free: out_free:
......
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