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;