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 C26DCC433DF for ; Wed, 24 Jun 2020 07:41:55 +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 90A7220768 for ; Wed, 24 Jun 2020 07:41:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="aLWHviE1"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="d37aL8ZJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 90A7220768 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=iO62o6C0CrhGxSXY3p37bAB4lRGBKgMua8Md/TWVD/M=; b=aLWHviE169UuAZ67NRHvOdgzK vpwWkwKJsmMvrpNxMm2GiH3yzzvC7HyDspdjWn6pNdFXo5x2r2J63zoeBKcQ+DIRqPF55pKMzt7gq QgS+3uRh7QHPDxDy4QZ4HxO8xqvEE61zYequjmJMBeh3On47pzrOeRi1DtmxkCmk+tFmEksO1Iilm QXnLI69xgiMQZeUQHaHZsbmSAQYGtAUeO083KzsBIqQ0vSrNVY6l5JCmZ+/lgtWixp7EKZDOyYK+U k23ZhTdrvDTGWpZu/DBKt2bQ5zR//n60LDGv063i66LUpGvyGv2kAfKD3In0I4xmrHo1Y9z3kVTS4 3uVVXcp3Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jo018-0007e0-5m; Wed, 24 Jun 2020 07:40:22 +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 1jo015-0007ce-Q2 for linux-arm-kernel@lists.infradead.org; Wed, 24 Jun 2020 07:40:20 +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 3CC7F206E2; Wed, 24 Jun 2020 07:40:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592984419; bh=o/fY5o8l3XzcwfN68Ui0RNm993lL6busdrWA2kWSPmI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=d37aL8ZJa79rDa/qeKgRVhGdn06DVd1IKAaH+VR6AMLLeB/CwI7sbIUVZp+6/eBVz wTdzu0d5M/eomjUo/ARHtVANB1s0XrLnVmFrNJsfYm28zZDGwQgL54Nn8jr76Q/plN 4Vf3dZpGwaPZv2tKdOyru/hCvQogy7+Yk9gZ9mKI= Date: Wed, 24 Jun 2020 13:10:15 +0530 From: Vinod Koul To: Navid Emamdoost Subject: Re: [PATCH] dmaengine: stm32-dmamux: fix pm_runtime_get_sync fialure cases Message-ID: <20200624074015.GP2324254@vkoul-mobl> References: <20200603193648.19190-1-navid.emamdoost@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200603193648.19190-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, 14:36, Navid Emamdoost wrote: s/fialure/failure > Calling pm_runtime_get_sync increments the counter even in case of > failure, causing incorrect ref count. Call pm_runtime_put_sync if > pm_runtime_get_sync fails. > > Signed-off-by: Navid Emamdoost > --- > drivers/dma/stm32-dmamux.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/dma/stm32-dmamux.c b/drivers/dma/stm32-dmamux.c > index 12f7637e13a1..ab250d7eed29 100644 > --- a/drivers/dma/stm32-dmamux.c > +++ b/drivers/dma/stm32-dmamux.c > @@ -140,6 +140,7 @@ static void *stm32_dmamux_route_allocate(struct of_phandle_args *dma_spec, > ret = pm_runtime_get_sync(&pdev->dev); > if (ret < 0) { > spin_unlock_irqrestore(&dmamux->lock, flags); > + pm_runtime_put_sync(&pdev->dev); why put_sync() > goto error; > } > spin_unlock_irqrestore(&dmamux->lock, flags); > @@ -340,8 +341,10 @@ static int stm32_dmamux_suspend(struct device *dev) > int i, ret; > > ret = pm_runtime_get_sync(dev); > - if (ret < 0) > + if (ret < 0) { > + pm_runtime_put_sync(dev); here too > return ret; > + } > > for (i = 0; i < stm32_dmamux->dma_requests; i++) > stm32_dmamux->ccr[i] = stm32_dmamux_read(stm32_dmamux->iomem, > -- > 2.17.1 -- ~Vinod _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel