From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1B91CA9EA0 for ; Fri, 25 Oct 2019 14:11:24 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B607221D81 for ; Fri, 25 Oct 2019 14:11:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="lYUAPJhg"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=st.com header.i=@st.com header.b="KY5ut593" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B607221D81 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=st.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:From:References:To:Subject:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=783OzSV2q0fogQaGoP6qWQOvx8ekREqC1a1/wDsbKlg=; b=lYUAPJhgJDNLNa clsyyGy7fihWbIg5wl8ZwZPoY520PxhgTo36vJg0TTjELWtFtP/BE32/DhLZZWydtAqQp5Qw3r3XK XBGkoTO6f3ISmkPZnTBP3pOvp3Dmco5EV+7vol4SSIY3PkYVkdk9e/HaCbsdRwhZMUBAPX/FpHQXB DZ6Agh26l7ouBINuEygPQXf56n0S3XY53bb4iHXloqyXV1YvbsunI1S7YO8r+aVx4bGWinDvgQCx9 gIuw4Z9wdy/DvjxB7WQ0dPW7DZONl9i6/bng8Tv62GDgRpMJ7a9UoGk4F+l7XLbMOfnpCaOpruEEb jhbvSM7D/sJv9kzwWn0A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iO0JH-0002H6-Kd; Fri, 25 Oct 2019 14:11:23 +0000 Received: from mx08-00178001.pphosted.com ([91.207.212.93] helo=mx07-00178001.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iO0JE-0002GC-9J for linux-arm-kernel@lists.infradead.org; Fri, 25 Oct 2019 14:11:21 +0000 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx08-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x9PE5wO4019861; Fri, 25 Oct 2019 16:11:14 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=STMicroelectronics; bh=j3crM7cBC/H2jOyoLqRWhR7cZrRuUQNXRsMuv0OdZuQ=; b=KY5ut593Qal9uBKcKy/ZEQWmOXE+fNIcYMyCbxWKE062MHN9ayQ6YrkCLT7IioLaK4AP NKzJXL9ZpohHBt0oCDLn0zbcn7fmotN7ZOBdkBV+BIcoyM9/iiCVXN3jG8b1zTMNgp/O pcS16hpQbYSZMDUbUWINzGzB8EAaMUAO41H00ReqpnjfbJtBkzf6EDF+PCz2VypaP4l0 lCPR4BMJK4ozmT1bBA45HLWX3MC1Q6j+Gg7X4TYANGwyZn83ZvUs6vTVS2cZUHedMJhV ZRUT9R6B4vf8/vKnokRcCntfD8nWv5sewLh7I5j2sT96BlJsaLsE59h2ZY2aqhvokl5w Ng== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 2vt9s5856g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 25 Oct 2019 16:11:13 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 5DA62100034; Fri, 25 Oct 2019 16:11:13 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag5node2.st.com [10.75.127.14]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 4E8E52AB34D; Fri, 25 Oct 2019 16:11:13 +0200 (CEST) Received: from [10.129.5.11] (10.75.127.46) by SFHDAG5NODE2.st.com (10.75.127.14) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 25 Oct 2019 16:11:12 +0200 Subject: Re: [PATCH] i2c: i2c-stm32f7: fix & reorder remove & probe error handling To: Alain Volmat , References: <1572012264-31996-1-git-send-email-alain.volmat@st.com> From: Pierre Yves MORDRET Message-ID: <37fc56c5-a700-a05b-2669-25295172dbdc@st.com> Date: Fri, 25 Oct 2019 16:11:10 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <1572012264-31996-1-git-send-email-alain.volmat@st.com> Content-Language: en-US X-Originating-IP: [10.75.127.46] X-ClientProxiedBy: SFHDAG2NODE2.st.com (10.75.127.5) To SFHDAG5NODE2.st.com (10.75.127.14) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,1.0.8 definitions=2019-10-25_08:2019-10-25,2019-10-25 signatures=0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191025_071120_620486_96B69583 X-CRM114-Status: GOOD ( 18.91 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alexandre.torgue@st.com, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, fabrice.gasnier@st.com, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Look good for me Reviewed-by: Pierre-Yves MORDRET Thanks On 10/25/19 4:04 PM, Alain Volmat wrote: > Add missing dma channels free calls in case of error during probe > and reorder the remove function so that dma channels are freed after > the i2c adapter is deleted. > Overall, reorder the remove function so that probe error handling order > and remove function order are same. > > Fixes: 7ecc8cfde553 ("i2c: i2c-stm32f7: Add DMA support") > > Signed-off-by: Alain Volmat > --- > drivers/i2c/busses/i2c-stm32f7.c | 19 ++++++++++++------- > 1 file changed, 12 insertions(+), 7 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c > index d36cf08461f7..f8ef203dabfc 100644 > --- a/drivers/i2c/busses/i2c-stm32f7.c > +++ b/drivers/i2c/busses/i2c-stm32f7.c > @@ -1980,6 +1980,11 @@ static int stm32f7_i2c_probe(struct platform_device *pdev) > pm_runtime_set_suspended(i2c_dev->dev); > pm_runtime_dont_use_autosuspend(i2c_dev->dev); > > + if (i2c_dev->dma) { > + stm32_i2c_dma_free(i2c_dev->dma); > + i2c_dev->dma = NULL; > + } > + > clk_free: > clk_disable_unprepare(i2c_dev->clk); > > @@ -1990,21 +1995,21 @@ static int stm32f7_i2c_remove(struct platform_device *pdev) > { > struct stm32f7_i2c_dev *i2c_dev = platform_get_drvdata(pdev); > > - if (i2c_dev->dma) { > - stm32_i2c_dma_free(i2c_dev->dma); > - i2c_dev->dma = NULL; > - } > - > i2c_del_adapter(&i2c_dev->adap); > pm_runtime_get_sync(i2c_dev->dev); > > - clk_disable_unprepare(i2c_dev->clk); > - > pm_runtime_put_noidle(i2c_dev->dev); > pm_runtime_disable(i2c_dev->dev); > pm_runtime_set_suspended(i2c_dev->dev); > pm_runtime_dont_use_autosuspend(i2c_dev->dev); > > + if (i2c_dev->dma) { > + stm32_i2c_dma_free(i2c_dev->dma); > + i2c_dev->dma = NULL; > + } > + > + clk_disable_unprepare(i2c_dev->clk); > + > return 0; > } > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel