nvme: Stop probing a removed device
authorKeith Busch <keith.busch@intel.com>
Tue, 11 Oct 2016 17:31:58 +0000 (13:31 -0400)
committerJens Axboe <axboe@fb.com>
Wed, 12 Oct 2016 14:40:13 +0000 (08:40 -0600)
There is no reason the nvme controller can ever return all 1's from
reading the CSTS register. This patch returns an error if we observe
that status. Without this, we may incorrectly proceed with controller
initialization and unnecessarilly rely on error handling to clean this.

Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
drivers/nvme/host/core.c

index 329381a28edf8a7e4b3bb4c6ca2da669ee9caa4a..2a57f5ede386c22b629c56519471859dc36a98ac 100644 (file)
@@ -1086,6 +1086,8 @@ static int nvme_wait_ready(struct nvme_ctrl *ctrl, u64 cap, bool enabled)
        int ret;
 
        while ((ret = ctrl->ops->reg_read32(ctrl, NVME_REG_CSTS, &csts)) == 0) {
+               if (csts == ~0)
+                       return -ENODEV;
                if ((csts & NVME_CSTS_RDY) == bit)
                        break;