diff options
author | Matthew Wilcox <matthew.r.wilcox@intel.com> | 2013-04-16 11:22:36 -0400 |
---|---|---|
committer | Matthew Wilcox <matthew.r.wilcox@intel.com> | 2013-04-16 15:13:41 -0400 |
commit | 422ef0c7c81934c3344e1623d2dcfda5fa2fab8d (patch) | |
tree | ba37240a322d81044a396e32e98bec9fcc534f9f /drivers/block/nvme-core.c | |
parent | 063cc6d5591ea9c0631b81ac5c7b829d99738b2f (diff) |
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: Matthew Wilcox <matthew.r.wilcox@intel.com>
Acked-by: Keith Busch <keith.busch@intel.com>
Diffstat (limited to 'drivers/block/nvme-core.c')
-rw-r--r-- | drivers/block/nvme-core.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c index f3ea52aa3e5d..357c961151a1 100644 --- a/drivers/block/nvme-core.c +++ b/drivers/block/nvme-core.c | |||
@@ -1502,6 +1502,12 @@ static void nvme_free_queues(struct nvme_dev *dev) | |||
1502 | nvme_free_queue(dev, i); | 1502 | nvme_free_queue(dev, i); |
1503 | } | 1503 | } |
1504 | 1504 | ||
1505 | /* | ||
1506 | * Return: error value if an error occurred setting up the queues or calling | ||
1507 | * Identify Device. 0 if these succeeded, even if adding some of the | ||
1508 | * namespaces failed. At the moment, these failures are silent. TBD which | ||
1509 | * failures should be reported. | ||
1510 | */ | ||
1505 | static int nvme_dev_add(struct nvme_dev *dev) | 1511 | static int nvme_dev_add(struct nvme_dev *dev) |
1506 | { | 1512 | { |
1507 | int res, nn, i; | 1513 | int res, nn, i; |
@@ -1555,7 +1561,7 @@ static int nvme_dev_add(struct nvme_dev *dev) | |||
1555 | } | 1561 | } |
1556 | list_for_each_entry(ns, &dev->namespaces, list) | 1562 | list_for_each_entry(ns, &dev->namespaces, list) |
1557 | add_disk(ns->disk); | 1563 | add_disk(ns->disk); |
1558 | 1564 | res = 0; | |
1559 | goto out; | 1565 | goto out; |
1560 | 1566 | ||
1561 | out_free: | 1567 | out_free: |