From: Keith Busch Date: Tue, 11 Oct 2016 17:31:58 +0000 (-0400) Subject: nvme: Stop probing a removed device X-Git-Tag: v4.9-rc2~16^2~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0df1e4f5e0e831670f43bd198623b303ba09cbc0;p=platform%2Fkernel%2Flinux-exynos.git nvme: Stop probing a removed device 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 Signed-off-by: Jens Axboe --- diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 329381a..2a57f5e 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -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;