From patchwork Mon May 17 08:18:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Kuai X-Patchwork-Id: 12261193 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 AD957C433B4 for ; Mon, 17 May 2021 08:27:42 +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 7A10361057 for ; Mon, 17 May 2021 08:27:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7A10361057 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=C2STEabm2I4ee/29V6XpG0rqA3fff85GqSiIF709Hkk=; b=ZJ0ZVoMh9cgFDEd9mGR/rCj44 BndVE49bAXcaFTq4B2PiwpuV+ayg3xHxmWEZ9Blm5opScd4Ec/zmqkrAJXyx4rReixw/uQhiIkRDf zxdaEsuYHBopsYSTtxPMQUBb9IpN2ez/XLU8e75764rPin4ZWCRq55Ihrn0x1+o6DbiyfHuHnk8IL m/a7KWW4cQw+q6uvG2oPcM+dZcIyPfU2Y0ghU6f/r0icB2nlZkNY70i/3oJXiyCqIJeSvsrON4BAJ UfGZNO2S2wRhQFcnCveyd7+mVf7xvijUzN/ehNr6finH0ZgiuSmIcxkeFMMadmrXIPqCEGR5Y6cVi dDSdmqizA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1liYZS-00EDyQ-Ru; Mon, 17 May 2021 08:25:51 +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 1liYLI-00EAyZ-EP for linux-arm-kernel@desiato.infradead.org; Mon, 17 May 2021 08:11:13 +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=ITPCvViDcMRNz6QsMdpWouX6vxMikjr8IsiBkQwZvrg=; b=hSp5M+Oz/p26RosEcLSnRS3auE vtqzsoLZPBkgn/n9UF3mnzbS3rmww1P8DHHdzidx/4NBdYcBVLxp7DIFv0oGMXaNuXyI1lTFVRXrJ 0yUOKeWt+LZr/+sOUw3NLazr+erTnnJX9huZ2yywQXh7Fk6OTr50RaeU9UkCL5OWIVpDM0lz38tqd vziT5X02KxC57Ms46m1BuCxzDmWVJIwQNMWpunJfCPPPAjDeXg6SL6wL1bV4Z60JXN8NsFkh9+Iqn QORKIfiiN102ldv/N2iBZyGOt/5lNq04uVetW80W5HI7O96j7l7OHdRTF/OdhzY3KF/DqY7cQCTXi 2XqsKQ+A==; Received: from szxga07-in.huawei.com ([45.249.212.35]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liYLC-00Da1Y-C0 for linux-arm-kernel@lists.infradead.org; Mon, 17 May 2021 08:11:11 +0000 Received: from dggems705-chm.china.huawei.com (unknown [172.30.72.58]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4FkBb63RVlzCt5q; Mon, 17 May 2021 16:08:18 +0800 (CST) Received: from dggema762-chm.china.huawei.com (10.1.198.204) by dggems705-chm.china.huawei.com (10.3.19.182) 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:00 +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:00 +0800 From: Yu Kuai To: , , , CC: , , , , , Subject: [PATCH 1/3] dmaengine: stm32-mdma: fix PM reference leak in stm32_mdma_alloc_chan_resourc() Date: Mon, 17 May 2021 16:18:24 +0800 Message-ID: <20210517081826.1564698-2-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_011106_595764_854611D7 X-CRM114-Status: UNSURE ( 9.64 ) 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/stm32-mdma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/dma/stm32-mdma.c b/drivers/dma/stm32-mdma.c index 36ba8b43e78d..18cbd1e43c2e 100644 --- a/drivers/dma/stm32-mdma.c +++ b/drivers/dma/stm32-mdma.c @@ -1452,7 +1452,7 @@ static int stm32_mdma_alloc_chan_resources(struct dma_chan *c) return -ENOMEM; } - ret = pm_runtime_get_sync(dmadev->ddev.dev); + ret = pm_runtime_resume_and_get(dmadev->ddev.dev); if (ret < 0) return ret; @@ -1718,7 +1718,7 @@ static int stm32_mdma_pm_suspend(struct device *dev) u32 ccr, id; int ret; - ret = pm_runtime_get_sync(dev); + ret = pm_runtime_resume_and_get(dev); if (ret < 0) return ret; From patchwork Mon May 17 08:18:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Kuai X-Patchwork-Id: 12261189 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 886EAC433ED for ; Mon, 17 May 2021 08:26:56 +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 4392861059 for ; Mon, 17 May 2021 08:26:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4392861059 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=K1k8AJYcCFz6V9FShzqk1j6/dMtLjBgqz1O11J9wlXE=; b=HXGAA+wgPVpvv7Nk/VTG9VGWg B/Ov03EfNjb0Mbww2WXw6rs7mo5Wu9TwypjqgXE2PDVynQ/GPG7ErgpR/RZn1QbUNTrvEKTYQIGQ5 jv4LjIm+Ifcv5u3hDP6/pHPTq5RFzdvkmwx+sIlvQ6o2J8awCDlkdbBIu2aEcxD2WfyZC+ffTMVfm XwdTwzeajcdcoLVFH3PHmSuEJxBgm8QFo1JbNaehv5vn9OmIFPMIJkg0bJgjsjnS4hwOJmj+Z+317 GKAyoLFxhZDQu7EDnqB/M+1grWsGeBaptw4/DXdcemGjTEtthyoctj2fr4AqSX2s79S55dx+A97AM ugCGFwrkQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1liYYo-00EDg7-Ok; Mon, 17 May 2021 08:25:11 +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 1liYLH-00EAyW-NO for linux-arm-kernel@desiato.infradead.org; Mon, 17 May 2021 08:11:13 +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=7NlY+oybdbNDpWWfsvtUIzmPQI4LRw9pS0ZiuAjBX7E=; b=lnaC6ZrFhDsgqjSy9Kc+ynrlyQ 6rhPlRTwaVFVfjm/xPDRFZEnG/eNJmkVt8Z0fJ6wQoL7fza4aCxX9qUjffVRpEeL4w5RPnPgkoNx7 JJmQVImOJ0ctffYA3OwZ7LAVuAKi7fy+f8a2/zllZMRSOy0lo6XG9953iYRsGN1MyCgsXtohYT5Ec 1aoe0aCbMOpCZMLB0dW+Zwhrdw7hoXtSl9JUcq2nbIw2E1qM91BIUSo1YZd/CxIyL8o8vyZs5lx6f MTu8LmSuzNzMHIKpSCTNKpzNh8b/a2W1mU5lfVaGwNc3NpwAKvnAyyiOVkkq5PRZkbMOT44N2iaiG dCMfY0pg==; Received: from szxga06-in.huawei.com ([45.249.212.32]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liYL9-00Da17-6a for linux-arm-kernel@lists.infradead.org; Mon, 17 May 2021 08:11:10 +0000 Received: from dggems706-chm.china.huawei.com (unknown [172.30.72.59]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4FkBbf6Qx0zmWv8; Mon, 17 May 2021 16:08:46 +0800 (CST) Received: from dggema762-chm.china.huawei.com (10.1.198.204) by dggems706-chm.china.huawei.com (10.3.19.183) 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:00 +0800 From: Yu Kuai To: , , , CC: , , , , , Subject: [PATCH 2/3] dmaengine: usb-dmac: Fix PM reference leak in usb_dmac_probe() Date: Mon, 17 May 2021 16:18:25 +0800 Message-ID: <20210517081826.1564698-3-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_421188_7FD8D799 X-CRM114-Status: GOOD ( 10.19 ) 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/sh/usb-dmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/sh/usb-dmac.c b/drivers/dma/sh/usb-dmac.c index 8f7ceb698226..2a6c8fd8854e 100644 --- a/drivers/dma/sh/usb-dmac.c +++ b/drivers/dma/sh/usb-dmac.c @@ -796,7 +796,7 @@ static int usb_dmac_probe(struct platform_device *pdev) /* Enable runtime PM and initialize the device. */ pm_runtime_enable(&pdev->dev); - ret = pm_runtime_get_sync(&pdev->dev); + ret = pm_runtime_resume_and_get(&pdev->dev); if (ret < 0) { dev_err(&pdev->dev, "runtime PM get sync failed (%d)\n", ret); goto error_pm; 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;