Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp127578ybb; Tue, 7 Apr 2020 18:35:31 -0700 (PDT) X-Google-Smtp-Source: APiQypLdjG1x0G4MByI/r9iiHomF/EelBqA6I+NbylYpnEphgVpErdOwm4e9mVlaWKNzxn5Mftkx X-Received: by 2002:aca:bec1:: with SMTP id o184mr740348oif.37.1586309731111; Tue, 07 Apr 2020 18:35:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586309731; cv=none; d=google.com; s=arc-20160816; b=NVulsc9K4djtX1fUWEDLfgjr575sFui1uhM+CQwpDVDgeVAw2Na7bBYgrrbcobIVaH Hr4+wDHe3YjK2CTcZN0DaMIp6cl6sBrdbZTXy6vJOay9JSvTmT4e/LB1edgSsugmDMFM AycVG209XnAmBlRQ7j2UfilH/dGi6xAVQ6yj2z1xKjuRHJjF4BdX1pjBtH2+7TiCKeD1 zm2L2vHF0f83YRoS8HB/2qAp3wtDHJ308eXq6ROxr5+6RIGUta1mkENC6btbPQ5Wq6Qg 8NoHsWVOMH/zIaDoQhMfZdyFKfMV9neSgV1hZxJHd8jCo+Z7STM6P8o7Ps+3RBIRderL UigA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature; bh=XoOYi2TV+UeP2kOoRrpUAk9Ku3EzZ9BU0fhtMfFP28s=; b=TgWiwXTqQY17aR0HM3mYRqnLxxZd54hZYs+ejh6K15++8bcys0/156brTFU1bYgrzx 59tXuYU/p1VniMmcGcKi7aAptyl/0opNQcY/Slm1/Up+S5LXV8A5cKpB62mDgqG1GU+X l5lajA/GkkGKMltHNPePRSxZ3/NibLAuHXyXjlGPIBMkI5ka0ZgBMxU1IGNacca6ToMQ kbtX5gJCtaKkE477HZed2MV373P6CzUkFAKsprxufl106PY9vtHUaIQcubVRwfvEyhzg udACsGo5kKOPN8UW+SFWXfFTiGpZFnL4vKfcxcMvn56A4SsJkQj4+2fT7D7GaYUOlgz1 N2fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=Pvpf7CZV; 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 g3si1393646oiy.151.2020.04.07.18.35.16; Tue, 07 Apr 2020 18:35:31 -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=Pvpf7CZV; 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 S1726484AbgDHBeU (ORCPT + 99 others); Tue, 7 Apr 2020 21:34:20 -0400 Received: from mail27.static.mailgun.info ([104.130.122.27]:60797 "EHLO mail27.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726420AbgDHBeT (ORCPT ); Tue, 7 Apr 2020 21:34:19 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1586309659; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=XoOYi2TV+UeP2kOoRrpUAk9Ku3EzZ9BU0fhtMfFP28s=; b=Pvpf7CZVEMApbiorlvaY+4vDU7H11aMv5kzGWZoi54RqlQH8ndO6FXfsEmeyH4tNQBo5ENc1 Nr9kfpsM6j7tYVgKa89kHBif2+NfR6fAENTJ3yB9tu+FSPhv+cNCFERzP7rdq/JN8ayIcygs yNxhJhb/D0hHEo1GXS6ht9Jvxoc= X-Mailgun-Sending-Ip: 104.130.122.27 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 5e8d2a0f.7f5cd5569340-smtp-out-n02; Wed, 08 Apr 2020 01:34:07 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 5D7ACC433D2; Wed, 8 Apr 2020 01:34:06 +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 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: hemantk) by smtp.codeaurora.org (Postfix) with ESMTPSA id C3AD1C433F2; Wed, 8 Apr 2020 01:34:05 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 07 Apr 2020 18:34:05 -0700 From: hemantk@codeaurora.org To: Jeffrey Hugo Cc: manivannan.sadhasivam@linaro.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm-owner@vger.kernel.org Subject: Re: [PATCH v2 2/5] bus: mhi: core: Make sure to powerdown if mhi_sync_power_up fails In-Reply-To: <1586278230-29565-3-git-send-email-jhugo@codeaurora.org> References: <1586278230-29565-1-git-send-email-jhugo@codeaurora.org> <1586278230-29565-3-git-send-email-jhugo@codeaurora.org> Message-ID: <7249d9608f41e4528c87c2b1c464d615@codeaurora.org> X-Sender: hemantk@codeaurora.org User-Agent: Roundcube Webmail/1.3.9 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-04-07 09:50, Jeffrey Hugo wrote: > 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 3285c9e..fbffc6b 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; Does it make sense to return -ETIMEDOUT instead of -EIO if device fails to move to mission mode? Controller can use this info as mhi_async_power_up() would not return -ETIMEDOUT. > + if (ret) > + mhi_power_down(mhi_cntrl, false); > + > + return ret; > } > EXPORT_SYMBOL(mhi_sync_power_up);