From: Christoph Hellwig Date: Fri, 9 Apr 2021 09:46:12 +0000 (+0200) Subject: nvme: do not try to reconfigure APST when the controller is not live X-Git-Tag: v4.19.191~32 X-Git-Url: https://git.fsl.cs.sunysb.edu/?a=commitdiff_plain;h=a3dd6095f1a66fd05fe79c96fb9f7a3a13d0ca03;p=wrapfs-2.6.37.y.git nvme: do not try to reconfigure APST when the controller is not live commit 53fe2a30bc168db9700e00206d991ff934973cf1 upstream. Do not call nvme_configure_apst when the controller is not live, given that nvme_configure_apst will fail due the lack of an admin queue when the controller is being torn down and nvme_set_latency_tolerance is called from dev_pm_qos_hide_latency_tolerance. Fixes: 510a405d945b("nvme: fix memory leak for power latency tolerance") Reported-by: Peng Liu Signed-off-by: Christoph Hellwig Reviewed-by: Keith Busch Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 513dd1e2aac7..e64310f2296f 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2091,7 +2091,8 @@ static void nvme_set_latency_tolerance(struct device *dev, s32 val) if (ctrl->ps_max_latency_us != latency) { ctrl->ps_max_latency_us = latency; - nvme_configure_apst(ctrl); + if (ctrl->state == NVME_CTRL_LIVE) + nvme_configure_apst(ctrl); } }