Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3708657ybb; Mon, 6 Apr 2020 14:06:45 -0700 (PDT) X-Google-Smtp-Source: APiQypIhfHJr7SYhojHtdZS6VZxuYjJlXl/jNz0beso35a2s07y/lJF3ArFP979IabAs7GTk3U9Y X-Received: by 2002:a9d:748e:: with SMTP id t14mr20042659otk.334.1586207204915; Mon, 06 Apr 2020 14:06:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586207204; cv=none; d=google.com; s=arc-20160816; b=qaX+/F/hnAgrGO9Tm1eUK+Ee8vrV7+pcTs78715s5bIWILvr+9rqo12CJdSGqNBEpv CbrhcwlHeiYTKanE3bZ8yLYHpXrDoD6VGLScUrj8lHXrpNcWENZIpAZbz25hDVb83aRc SHY1yTIWq1K+c52FA1dCBRAka3/9NCtdz8nVWWV1RCEvFTJCQ8UKnkodQEph+KVy1dSj KzxaIAPq7s63PiikhN9ceD9N42ywZOJLzn6tRVH/9k+jPfQcJACwwirKt1EYOREWsRdf ipxp/xF1dWRVEMtxw6QBdsntDThtRad6A3xD/pIdzaNi+yv+cxRf3Y8Hg6WQ432IlDGU tfgw== 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=w50ln/+rXgPPydDWZtLcHgTcIiGUeG50FIqkzSlzc7k=; b=A8Qn4k2FUPaorHOf2wQq3NDOlLexumit7AOjtRFqDdhg8X2+cynpQPnUtBRTRlq5W+ OF6Thr3CvToYeEGdUhQCGNFvA7T2MJFuz/Ej/N2/59CngQTbkSJHsgeM+dxsDQm4XEbL j13VDU2m5m/S8WjeSV39hX90Zh7xdp5aEZtFFfRu9zaYqL+SriL40Mo4As9i43pyvb6a vIkp+gub8C6LTHfD7SnXE0DFA8kzt59taxm69RYuIsfMi3MaXI1b7+1bkVNBnQ+s23ej s+VG1W2aLDTHLKlfW7E1Ut0Yj/qnUUtbbdQnZN+ugzUTP+snc1zSkjGN0zCRbwN52bCI 9u8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=K7C8zAW3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u15si325692ooq.37.2020.04.06.14.06.32; Mon, 06 Apr 2020 14:06:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=K7C8zAW3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726438AbgDFVFu (ORCPT + 99 others); Mon, 6 Apr 2020 17:05:50 -0400 Received: from mail26.static.mailgun.info ([104.130.122.26]:18186 "EHLO mail26.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726254AbgDFVFr (ORCPT ); Mon, 6 Apr 2020 17:05:47 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1586207147; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=w50ln/+rXgPPydDWZtLcHgTcIiGUeG50FIqkzSlzc7k=; b=K7C8zAW3XNoXdPF0ykzLGuGJs0nmFlZBc7Fy+SNwOpMvq7vWU8yWj9t3PN25jEbfqUQBjgmV kRPsp4tGyj2Jcm2wlw2O1qFzBO6EoUys2JgyoqW3KkVEJkJyCTuzSr30k4bwZq3Utmw1cPNe XsH1vYNNeyKfbO7tlzM+KRgNnxA= 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 5e8b99ab.7f869332d420-smtp-out-n05; Mon, 06 Apr 2020 21:05:47 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 04C95C43637; Mon, 6 Apr 2020 21:05:46 +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 autolearn=unavailable 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 1745FC43636; Mon, 6 Apr 2020 21:05:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 1745FC43636 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: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Jeffrey Hugo Subject: [PATCH 2/3] bus: mhi: core: Make sure to powerdown if mhi_sync_power_up fails Date: Mon, 6 Apr 2020 15:04:36 -0600 Message-Id: <1586207077-22361-3-git-send-email-jhugo@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1586207077-22361-1-git-send-email-jhugo@codeaurora.org> References: <1586207077-22361-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 cd6ba23..1bfa334 100644 --- a/drivers/bus/mhi/core/pm.c +++ b/drivers/bus/mhi/core/pm.c @@ -922,7 +922,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 : -EIO; + + 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.