Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3044207ybz; Mon, 27 Apr 2020 09:01:35 -0700 (PDT) X-Google-Smtp-Source: APiQypIDGFm18N2BwSjPu2TOPKPy5pMR4kt7TZfml2ICBBRZlqQeY7viGfmOrHej0gvhc5OZwuVG X-Received: by 2002:a17:906:a390:: with SMTP id k16mr19224897ejz.219.1588003295515; Mon, 27 Apr 2020 09:01:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588003295; cv=none; d=google.com; s=arc-20160816; b=zStfGMPxQkSLYJ9mgGkULFkuVVLs2mjMJ4p3I6lNq+4zrE5PGSo9fG9UAsxV1OnNaq Y1O/T5dRSwg1mNHZHMhe98wHd6axXLDEGTXnlRcGoWiKAsYLcECf1YYaAqoJn2PPT5wz FMSLLqRkVnv0t2+HcWnIGYptuNBZGFIfAz+X+NO2DIj5aYfZRLS1QxaYMFYNO+ctIsUD Z6bjTul8ShKY3Yk5jnTZgmvTotNItp1vNvwN3LhrTGaW9OUiHrnWuNB5/jzpKDqEftSI yGi380lLM5z5SPOqMixcDUwCvwajbyGHK0A/avSkigX6sL2a0eK/R4YCSDR1FnOT0P3V R6nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature; bh=CXYmgRCO81Hh7DKx4YAGDyQPNSLKrhyVfEISQa9j/wg=; b=MTBz3QCs6gAR9dCtzCofjEbCJg0kEOP2KqCSvm8HCE95HuWAOH6Igt8fguRa1vUxMU ulHinRmo43JLyM0g8k2GkSIesyqgNadZc+1PWwWZcH5YblsZ0Qh+Yig5NyEYnwQUMZvb 2ZXNLEE+7Scv/fYbeQUVTnRGtAnrLljxIc98Ks+twcUjUHxXbsghoC//vLovOD9tQkpC oKBnFi/WFmNRv1/lxFUSBv4bDdZ0jkrGUDiIawBoUOfrWPpj39v/Udc2b1OB0nKajdIr dv2hV1aVlZrT178UYFb0nCccXdBBJ5BCrM2Zt++gttU66v40U010A+VPXvnOeqYxupYo zhNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=cBgG6yWv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k15si6765ejs.61.2020.04.27.09.01.01; Mon, 27 Apr 2020 09:01:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=cBgG6yWv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728135AbgD0P7c (ORCPT + 99 others); Mon, 27 Apr 2020 11:59:32 -0400 Received: from mail26.static.mailgun.info ([104.130.122.26]:39760 "EHLO mail26.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727084AbgD0P7c (ORCPT ); Mon, 27 Apr 2020 11:59:32 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1588003172; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=CXYmgRCO81Hh7DKx4YAGDyQPNSLKrhyVfEISQa9j/wg=; b=cBgG6yWvz69b0BxhI+wHP4JgHx49LZpk40+f1f2ZNw4h4pFkDEzRFj/lIeuqNH6qW0ycuASW v3Cya7k6U2pk+6/4gR1AGax1VF/jfP96BJtjjpiuT/IWcBSKNh3LNwaSEAdWoa8BPAkZk3z5 crGoMpXiQkjKFK30dtBGaVnMk1c= X-Mailgun-Sending-Ip: 104.130.122.26 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5ea70163.7f7371eb0110-smtp-out-n03; Mon, 27 Apr 2020 15:59:31 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 3D0EEC433F2; Mon, 27 Apr 2020 15:59:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from jhugo-perf-lnx.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jhugo) by smtp.codeaurora.org (Postfix) with ESMTPSA id 56AD8C433CB; Mon, 27 Apr 2020 15:59:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 56AD8C433CB Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=jhugo@codeaurora.org From: Jeffrey Hugo To: manivannan.sadhasivam@linaro.org, hemantk@codeaurora.org Cc: bbhatt@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Jeffrey Hugo Subject: [PATCH v3 1/6] bus: mhi: core: Make sure to powerdown if mhi_sync_power_up fails Date: Mon, 27 Apr 2020 09:59:08 -0600 Message-Id: <1588003153-13139-2-git-send-email-jhugo@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1588003153-13139-1-git-send-email-jhugo@codeaurora.org> References: <1588003153-13139-1-git-send-email-jhugo@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Powerdown is necessary if mhi_sync_power_up fails due to a timeout, to clean up the resources. Otherwise a BUG could be triggered when attempting to clean up MSIs because the IRQ is still active from a request_irq(). Signed-off-by: Jeffrey Hugo --- drivers/bus/mhi/core/pm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c index 52690cb..dc83d65 100644 --- a/drivers/bus/mhi/core/pm.c +++ b/drivers/bus/mhi/core/pm.c @@ -902,7 +902,11 @@ 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 : -EIO; + ret = (MHI_IN_MISSION_MODE(mhi_cntrl->ee)) ? 0 : -ETIMEDOUT; + if (ret) + mhi_power_down(mhi_cntrl, false); + + return ret; } EXPORT_SYMBOL(mhi_sync_power_up); -- Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.