Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2354760pxj; Sun, 30 May 2021 23:22:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztiaiM30/SU2+dokrNxglOlfWZbFVIBOvFblzs8tVXY4z5+5pMyN1BI+1X3kOByNcGQAV1 X-Received: by 2002:a17:906:2cce:: with SMTP id r14mr20630463ejr.38.1622442155838; Sun, 30 May 2021 23:22:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622442155; cv=none; d=google.com; s=arc-20160816; b=faMAKObz/7qfeF9oNA6lFmWw9WgUWJzG+f6WhRKh2MFir7ApE4PWb1/9MJzaBMgDcR 2fRsPF4KiDc2fgKu82joTaP2OmVh1xEat+WJkfvuYi9xKyR1omheX/hLEqE4en/8Kecb Nns8Ffyssq7P20/Fi/z92T3agkUXkR4Pz9j+R8xHKVmHtopEwCb9G8EqgJoVVhmBhLZS eX8LH/bjzeMpdxApFFcDwz5GqYj/c0xfTjawVrPEzwXTeHMyNhCxKYSBoRdUg5qSjo9r uXS/rL3W7HcoY++IGV0cEnY/JfYr3XwJhrn3kUZYpqTTBijVD8izwkErIBhgrFBgPESR V7ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=YrB8YNgZ9hQMehNb0Oat6jK/ry2ntDcUXwG/Ga/+pRE=; b=ahHXSOUZupHZru8bjmZxXAiNAB6OmF7ylIy3Dbk4WS60wsrfYcAzoSQypP1pI2+eHA eMTz0dCgw008+BLeA7uyKcXREz6RgtuPIJojVBg2I6XBKaBU3hNR3W5koNGlKfcmZ1+k L7d7hhyuJdVBkB25L3PVApCEEebaTBN15AbOUzttnuEMRlHBAEfTfnLo5AXfAQFgMmkd Vl5Xl3qxuSZsroFfKhnPrbRjuzgXZQFknvupeBQxx1WbB0yc0nRAooHXKU10/G4sI/Pl np9JNlViubUVYF3kB3IrM57d2HeBKLmAEE7vV07EozwftXi+W1ehW70Y7FqThRxxYj1w X/kQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f22si12538606ejk.353.2021.05.30.23.22.13; Sun, 30 May 2021 23:22:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230214AbhEaGVt (ORCPT + 99 others); Mon, 31 May 2021 02:21:49 -0400 Received: from szxga08-in.huawei.com ([45.249.212.255]:3300 "EHLO szxga08-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230202AbhEaGVl (ORCPT ); Mon, 31 May 2021 02:21:41 -0400 Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4FtlQJ4SyJz1BGcK; Mon, 31 May 2021 14:15:20 +0800 (CST) Received: from dggemi762-chm.china.huawei.com (10.1.198.148) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Mon, 31 May 2021 14:20:00 +0800 Received: from linux-lmwb.huawei.com (10.175.103.112) by dggemi762-chm.china.huawei.com (10.1.198.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Mon, 31 May 2021 14:19:59 +0800 From: Zou Wei To: , , , CC: , , Zou Wei Subject: [PATCH -next] dmaengine: sprd: Fix PM reference leak in sprd_dma_probe() Date: Mon, 31 May 2021 14:38:38 +0800 Message-ID: <1622443118-54216-1-git-send-email-zou_wei@huawei.com> X-Mailer: git-send-email 2.6.2 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.103.112] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggemi762-chm.china.huawei.com (10.1.198.148) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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: Zou Wei --- drivers/dma/sprd-dma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c index 0ef5ca8..65dde39 100644 --- a/drivers/dma/sprd-dma.c +++ b/drivers/dma/sprd-dma.c @@ -1203,7 +1203,7 @@ static int sprd_dma_probe(struct platform_device *pdev) pm_runtime_set_active(&pdev->dev); pm_runtime_enable(&pdev->dev); - ret = pm_runtime_get_sync(&pdev->dev); + ret = pm_runtime_resume_and_get(&pdev->dev); if (ret < 0) goto err_rpm; @@ -1238,7 +1238,7 @@ static int sprd_dma_remove(struct platform_device *pdev) struct sprd_dma_chn *c, *cn; int ret; - ret = pm_runtime_get_sync(&pdev->dev); + ret = pm_runtime_resume_and_get(&pdev->dev); if (ret < 0) return ret; -- 2.6.2