[PATCH] nvme: fix APST error for power latency tolerance

pngliu at hotmail.com pngliu at hotmail.com
Tue Mar 23 07:31:33 GMT 2021


From: Peng Liu <liupeng17 at lenovo.com>

Clear apsta so that nvme_configure_apst() does not execute
nvme_set_features(), which will fail because admin_q is either not set up
yet or no longer available at the time of nvme_uninit_ctrl() being called,
and this leads to the error message "nvme nvme0: failed to set APST feature
(-19)".

Fixes: 510a405d945b("nvme: fix memory leak for power latency tolerance")

Signed-off-by: Peng Liu <liupeng17 at lenovo.com>
---
 drivers/nvme/host/core.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index e68a8c4ac5a6..413a33c67655 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -4475,7 +4475,11 @@ void nvme_uninit_ctrl(struct nvme_ctrl *ctrl)
 {
 	nvme_hwmon_exit(ctrl);
 	nvme_fault_inject_fini(&ctrl->fault_inject);
+
+	/* clear APSTA since admin_q is unavailable for feature setting */
+	ctrl->apsta = 0;
 	dev_pm_qos_hide_latency_tolerance(ctrl->device);
+
 	cdev_device_del(&ctrl->cdev, ctrl->device);
 	nvme_put_ctrl(ctrl);
 }
-- 
2.25.1




More information about the Linux-nvme mailing list