Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1589449pxb; Thu, 4 Feb 2021 17:49:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJz/Ypi/TJB0MtS2JLzHSf+2QEa2dvkXN7c8nykAjDNlvjSvxqrr0N3ApWY1ohllpPjbWMu5 X-Received: by 2002:a17:906:78a:: with SMTP id l10mr1776608ejc.264.1612489751888; Thu, 04 Feb 2021 17:49:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612489751; cv=none; d=google.com; s=arc-20160816; b=EAa7rboCD+zH20305uyyEPEcQPT40ICnTcS/bfLsB8j0cEtMyACwfx4iU6mOFCktXV DJkvhWdulZML9D2WzAUoPwdyVrXZa+tjAGHDKcZxlVz0u7KCiW10Xy9xbjD9VBxG9HEo DcVByLyVL88H6Phj/fzHrh2EexE3pw0XByNJTKPM0MC8zNMysWrqWL2TkY2KJ1Be/fBn TISdN2aX0MHQ3pMbIf2IyRcc8oJmQ0plbenLkMaZxCepqeIKKpGW2DdMNiig+aFEbddc m8w/p3+fQPzjHixNIihRcQxJjpLThzxdLejYYg4hH7WMvd6gZYNuoL+8bg/79yTloDkj fGqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dmarc-filter:sender:dkim-signature; bh=hbK6fy4IEb0Eekgpe2dfHwy2puVxFFmEFW8ZMxZZvyo=; b=C+wnCVkHR27vZuwMoBd29uM1r29PMlc+Vr6iVL00Za+vXg760cnmZpd5/UueAC14If 6pilxXzyaoJj3xQa1zCZu/h5zXkxCSMVSbPD66Cj94/ps9X4MoudBxOa0HhkUJiw6qh0 1hq6b1yPYr5pHbP6dyGYE1CFm5D8cY+2ZDCoygYBCSmW0k3KG2t6qUXwT7eB0xV9QO/Z pYDvQ55jOXJ5cUzWRpndJ1Ye8pDQ7t+1DRm20IuHrA1yRa9MDPc+NtvCvyfSx822nGLW epsZswTpJDHWOczkHgxU2+G0gaMMIYArQqKIfML623jIgwi3jxxhaIQYgm/qZ/VgWnSR HWng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=r14N6LFO; 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 hp6si4038636ejc.532.2021.02.04.17.48.47; Thu, 04 Feb 2021 17:49:11 -0800 (PST) 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=pass header.i=@mg.codeaurora.org header.s=smtp header.b=r14N6LFO; 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 S240049AbhBDUdW (ORCPT + 99 others); Thu, 4 Feb 2021 15:33:22 -0500 Received: from mail29.static.mailgun.info ([104.130.122.29]:12736 "EHLO mail29.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240143AbhBDU3N (ORCPT ); Thu, 4 Feb 2021 15:29:13 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1612470534; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=hbK6fy4IEb0Eekgpe2dfHwy2puVxFFmEFW8ZMxZZvyo=; b=r14N6LFOOaR1VSCy4La1lhLRI7qNz2K2IXk4mKf/Sx9W1hLfjlpVKnPMx2RU2Nq+FPceMGEj FUedkqsfyDG0L8ISq8KvzgTYX8lpZ2fJAhEFuocj6M+VVexkhK5e/GdhxyRWwyy0gPSjvBYy /juWGhhrls2WD5H0zVe/qs7rev0= X-Mailgun-Sending-Ip: 104.130.122.29 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 smtp-out-n07.prod.us-west-2.postgun.com with SMTP id 601c58e234db06ef79cbe54d (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Thu, 04 Feb 2021 20:28:18 GMT Sender: bbhatt=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 57830C43466; Thu, 4 Feb 2021 20:28:18 +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=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from malabar-linux.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: bbhatt) by smtp.codeaurora.org (Postfix) with ESMTPSA id 91A67C433CA; Thu, 4 Feb 2021 20:28:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 91A67C433CA 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=fail smtp.mailfrom=bbhatt@codeaurora.org From: Bhaumik Bhatt To: manivannan.sadhasivam@linaro.org Cc: linux-arm-msm@vger.kernel.org, hemantk@codeaurora.org, jhugo@codeaurora.org, linux-kernel@vger.kernel.org, loic.poulain@linaro.org, Bhaumik Bhatt Subject: [PATCH v6 8/8] bus: mhi: core: Do not clear channel context more than once Date: Thu, 4 Feb 2021 12:28:06 -0800 Message-Id: <1612470486-10440-9-git-send-email-bbhatt@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1612470486-10440-1-git-send-email-bbhatt@codeaurora.org> References: <1612470486-10440-1-git-send-email-bbhatt@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Clearing a channel context can happen twice if the client driver unprepares and reset the channels from the remove() callback from a controller requested MHI power down sequence. If there are multiple attempts at calling the mhi_free_coherent() API, we see kernel warnings such as "trying to free invalid coherent area". Example for one such client is the QRTR MHI driver. Avoid these warnings by skipping mhi_deinit_chan_ctxt() API call and prevent extra work from MHI as the channels are already disabled. Signed-off-by: Bhaumik Bhatt --- drivers/bus/mhi/core/init.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c index 30eef19..272f350 100644 --- a/drivers/bus/mhi/core/init.c +++ b/drivers/bus/mhi/core/init.c @@ -1314,6 +1314,7 @@ static int mhi_driver_remove(struct device *dev) if ((ch_state[dir] == MHI_CH_STATE_ENABLED || ch_state[dir] == MHI_CH_STATE_STOP) && + mhi_chan->ch_state != MHI_CH_STATE_DISABLED && !mhi_chan->offload_ch) mhi_deinit_chan_ctxt(mhi_cntrl, mhi_chan); -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project