From 4580871a15936ae1cac990711064764779ac8ba4 Mon Sep 17 00:00:00 2001 From: Bhaumik Bhatt Date: Mon, 3 Aug 2020 12:50:43 -0700 Subject: [PATCH] mhi: core: Make sure to powerdown if mhi_sync_power_up fails Power down is necessary if mhi_sync_power_up fails due to any timeout, to clean up the resources. Otherwise, an assert could be triggered when attempting to clean up MSIs because the IRQ is still active from a request_irq(). Do not allow this for RDDM supported controllers, as ramdump collection prior to powering down maybe needed. Change-Id: I7469e6ad190d21ed69bb2a03fde56c969a672fa3 Signed-off-by: Bhaumik Bhatt --- drivers/bus/mhi/core/mhi_pm.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/bus/mhi/core/mhi_pm.c b/drivers/bus/mhi/core/mhi_pm.c index 74548ba2716d..a07a92354e5f 100644 --- a/drivers/bus/mhi/core/mhi_pm.c +++ b/drivers/bus/mhi/core/mhi_pm.c @@ -1129,7 +1129,13 @@ int mhi_sync_power_up(struct mhi_controller *mhi_cntrl) MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state), msecs_to_jiffies(mhi_cntrl->timeout_ms)); - return (MHI_IN_MISSION_MODE(mhi_cntrl->ee)) ? 0 : -ETIMEDOUT; + if (!MHI_IN_MISSION_MODE(mhi_cntrl->ee)) { + if (!mhi_cntrl->rddm_supported) + mhi_power_down(mhi_cntrl, false); + return -ETIMEDOUT; + } + + return 0; } EXPORT_SYMBOL(mhi_sync_power_up);