From patchwork Mon May 17 08:18:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Kuai X-Patchwork-Id: 12261179 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=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT 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 08442C433ED for ; Mon, 17 May 2021 08:26:11 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 CAE4561209 for ; Mon, 17 May 2021 08:26:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CAE4561209 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=CzYZJXaa9pXlS2RgOpogSr2DE3mXhkojRQloi5vCIDA=; b=iqLBlt316vcu7vJQlO9Nd4d5y KtdyBMh98NqYrYeRXuTLk7IT7OGX3WKJPhUkrgbJ6wdFdThy7mdlRyfFiPUnHm493N/B1kzBLkfKS 1GfsrwVqw8YyWRDRG2z5W9hvqQp2pZQ221czUjxWrQX/KAuKAPuv+icDJJi+cEieFcHXziQxft5T2 l6ju6p3bwiHOtNLQuKEV+AMLBsC+ESGNkmnAp0hW0jfGYc1r2lKAQBIqmQasA044Tkegl6rnyJHhy fxuiW4dJHF69i5OwzHt2dYKRmJgDnjmJQRafR3GeMG9uifa0uSbb4XREb2rXUl2QsMPitlaSfGiDE YewpjQJVw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1liYV2-00EDG2-8D; Mon, 17 May 2021 08:21:16 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liYLD-00EAxD-Al for linux-arm-kernel@desiato.infradead.org; Mon, 17 May 2021 08:11:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Sender:Reply-To:Content-ID:Content-Description; bh=cY5weePh6hbFYb+INm9OE6LRDQHX3rgRJ82kCsZCh5w=; b=JJmLWWTXFEgASAtHyPtm/CV/pl PMDt4CAwv6MQJLM1ueZlmKYtbkZKidv2ph1FcDzRTgQrk4XZzVHOcRkkIRTM3sGI7+EnKr2Sfrd0u X3BFIp4NwTmY9EoAUcVHZ7gAfiYFHUSPjhALU6JXPpcfQIiZFkwZq5B5tiCnqyEOsNlDdQnZyoZz2 ax6+hczMp5ZTUAQJazCnNtj+p2OvWBx3hmKT31fDQmexdBlsoMrzlF4L+M9nuRG3dhLiqi39RoIs8 nPiMauEPi8738/T1BjnK7HWvERGu7K6i2CYWHLRcHOPdGQPV9oau4rj2/feW80yFy4v2+z49idwSx QVxHNAWQ==; Received: from szxga04-in.huawei.com ([45.249.212.190]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liYL9-00Da18-JE for linux-arm-kernel@lists.infradead.org; Mon, 17 May 2021 08:11:06 +0000 Received: from dggems704-chm.china.huawei.com (unknown [172.30.72.59]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4FkBZG4MSYzmjG0; Mon, 17 May 2021 16:07:34 +0800 (CST) Received: from dggema762-chm.china.huawei.com (10.1.198.204) by dggems704-chm.china.huawei.com (10.3.19.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Mon, 17 May 2021 16:11:01 +0800 Received: from huawei.com (10.175.127.227) by dggema762-chm.china.huawei.com (10.1.198.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Mon, 17 May 2021 16:11:01 +0800 From: Yu Kuai To: , , , CC: , , , , , Subject: [PATCH 3/3] dmaengine: zynqmp_dma: Fix PM reference leak in zynqmp_dma_alloc_chan_resourc() Date: Mon, 17 May 2021 16:18:26 +0800 Message-ID: <20210517081826.1564698-4-yukuai3@huawei.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20210517081826.1564698-1-yukuai3@huawei.com> References: <20210517081826.1564698-1-yukuai3@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggema762-chm.china.huawei.com (10.1.198.204) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210517_011103_808580_46432580 X-CRM114-Status: UNSURE ( 9.56 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org pm_runtime_get_sync will increment pm usage counter even it failed. Forgetting to putting operation will result in reference leak here. Fix it by replacing it with pm_runtime_resume_and_get to keep usage counter balanced. Reported-by: Hulk Robot Signed-off-by: Yu Kuai --- drivers/dma/xilinx/zynqmp_dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c index d8419565b92c..5fecf5aa6e85 100644 --- a/drivers/dma/xilinx/zynqmp_dma.c +++ b/drivers/dma/xilinx/zynqmp_dma.c @@ -468,7 +468,7 @@ static int zynqmp_dma_alloc_chan_resources(struct dma_chan *dchan) struct zynqmp_dma_desc_sw *desc; int i, ret; - ret = pm_runtime_get_sync(chan->dev); + ret = pm_runtime_resume_and_get(chan->dev); if (ret < 0) return ret;