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=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 3D372C433DF for ; Wed, 24 Jun 2020 07:48:06 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 082F320768 for ; Wed, 24 Jun 2020 07:48:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Xi7Xei7B"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="TZsT3ySZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 082F320768 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+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=merlin.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:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=QomrXIAY6y74anxLnM4izCD3cODtAftCdvVN5a+yscg=; b=Xi7Xei7BQSzHtiqzthXNcGHVg jilt6k0bxDt+do3BGh5oBAJ5wSQpKnRlCijpd8DmVVGd4jkRCfMfdVvibzfmfu6NOYb9Rgo5V1gEI ihxpvSRVgFG8rC5QIAQKi+NRzGzKJYrzYtEKequzMX2B0aBlf8jw5fB+ldnTv5OGfHrln9MXhdQkh 7KovBm9tDDvcBFTy8Bwx7X4Zr8ZVHVtfUsD+blMDTpP+viTUwpepwHk7MDenVtoH3lcMa/lqBxgVn CPikqpgCGZ8+o09SqBh7UwbTt/pLTkrUHem3T1uvNjjtNFkA0iZRENF7Wm/cpWna6RB7fTjQIP2n/ fNw9ulqHw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jo06u-0001W7-Vt; Wed, 24 Jun 2020 07:46:21 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jo06r-0001Uq-T6 for linux-arm-kernel@lists.infradead.org; Wed, 24 Jun 2020 07:46:18 +0000 Received: from localhost (unknown [171.61.66.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6DFFF20874; Wed, 24 Jun 2020 07:46:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592984777; bh=Pqvog+kc4WzGeG+jHR1QQdfOtKiGAH+Ios6F59XvbQY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=TZsT3ySZDW0LMtJpGzvg+4Fl8S+NyPsoQC/i70Ntirwdan/z//IH8ph1ANhyMctlG NFo04JeMLcMP2Apt1SAHCWUy2OdGFs8rlqcWmhqJoHvQVQGU46XpUdWwA36LzEfyBQ ANtdxTKJU7fH9TZ99SaTNnEg2mBG52JQIggjrgSI= Date: Wed, 24 Jun 2020 13:16:13 +0530 From: Vinod Koul To: Navid Emamdoost Subject: Re: [PATCH] dmaengine: stm32-mdma: call pm_runtime_put if pm_runtime_get_sync fails Message-ID: <20200624074613.GS2324254@vkoul-mobl> References: <20200603182850.66692-1-navid.emamdoost@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200603182850.66692-1-navid.emamdoost@gmail.com> 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 , wu000273@umn.edu, kjlu@umn.edu, linux-kernel@vger.kernel.org, emamd001@umn.edu, Maxime Coquelin , smccaman@umn.edu, dmaengine@vger.kernel.org, Dan Williams , 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+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 03-06-20, 13:28, Navid Emamdoost wrote: > Calling pm_runtime_get_sync increments the counter even in case of > failure, causing incorrect ref count. Call pm_runtime_put if > pm_runtime_get_sync fails. > > Signed-off-by: Navid Emamdoost > --- > drivers/dma/stm32-mdma.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/drivers/dma/stm32-mdma.c b/drivers/dma/stm32-mdma.c > index 5469563703d1..79bee1bb73f6 100644 > --- a/drivers/dma/stm32-mdma.c > +++ b/drivers/dma/stm32-mdma.c > @@ -1449,8 +1449,10 @@ static int stm32_mdma_alloc_chan_resources(struct dma_chan *c) > } > > ret = pm_runtime_get_sync(dmadev->ddev.dev); > - if (ret < 0) > + if (ret < 0) { > + pm_runtime_put(dmadev->ddev.dev); > return ret; > + } > > ret = stm32_mdma_disable_chan(chan); > if (ret < 0) > @@ -1718,8 +1720,10 @@ static int stm32_mdma_pm_suspend(struct device *dev) > int ret; > > ret = pm_runtime_get_sync(dev); > - if (ret < 0) > + if (ret < 0) { > + pm_runtime_put_sync(dev); Not put_sync()... > return ret; > + } > > for (id = 0; id < dmadev->nr_channels; id++) { > ccr = stm32_mdma_read(dmadev, STM32_MDMA_CCR(id)); > -- > 2.17.1 -- ~Vinod _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel