[PATCH 8/9] nvme-pci: return early on ctrl state mismatch in nvme_reset_work

Christoph Hellwig hch at lst.de
Tue Nov 29 05:22:07 PST 2022


When nvme_reset_work is called not in the resetting state something went
horribly wrong and we should not try to touch the controller registers,
so just leave the controller alone.

Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 drivers/nvme/host/pci.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 1b527377e35197..02940b4f42b104 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2792,8 +2792,7 @@ static void nvme_reset_work(struct work_struct *work)
 	if (dev->ctrl.state != NVME_CTRL_RESETTING) {
 		dev_warn(dev->ctrl.device, "ctrl state %d is not RESETTING\n",
 			 dev->ctrl.state);
-		result = -ENODEV;
-		goto out;
+		return;
 	}
 
 	/*
-- 
2.30.2




More information about the Linux-nvme mailing list