Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1190810pxu; Fri, 27 Nov 2020 01:44:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJwFoZPCnz9nHbiusLvip3TADY+vSBI98AURXy9Owd+4FXltrocgYqEvEMW6i3XosjvrxeKw X-Received: by 2002:a17:906:b255:: with SMTP id ce21mr6544807ejb.137.1606470250826; Fri, 27 Nov 2020 01:44:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606470250; cv=none; d=google.com; s=arc-20160816; b=Wun3d2dvb5INcH5bpZDc9/z1QF4RnSnDHBFfiMCZnVY1BtMShCQpTIAfMjAwBz9qmF YKEh72NCveLC7evDf1tlHeleVkpbZdHnaVYcOAmxQvrFXVyzTT6afy9MC++iT5lfq6WT EQmqjbvxKq7kEc3kX5PsQOM6vyLdNVuwrG4cAWF0C1GY8TWbd7wZHoFeRQPYl5jr8/Jf zIxCTvGtXP6gsxxB2oITICUWlA9sPcS8ZoYcpmnV4ETGyLlWpTzKgStQ5r5nEHca6lHg Mxqjeeeuy2X7/TobJ1KKKnVFl8AV6cPX5WGuFm7Kuwd40BfU8SZy8oNQ/NvH4O/okUBU gUMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=2hEbJjxJfuZ6U8MZMeGRiQ2tC8mMcK4pTjmUgKuXNkE=; b=JsScGiqHfC28MLhBKl3Yi3R40TVrYycsOWXK7qNmqYbfMHwC3qF79bnx1hkVPbudJZ 2EHd/Ml2nAYDeXoZK3l3M0NZ6ZjfrHp+Y3jBKo1K9AcmYRPCWRydqRzZav+coNexL6LB mj1MJXJRQJEKNTxWCjajzL26+QmCCIqchx9h5mTsjxAhmFKGky70EkmWG1H5XBpvWGlP 7siwoTJ0VtVzJ+v62joZFRHu0vEfPyr+Qb++E9Td85pN4d6W9DFjTWpZaxOQYk8rfwa/ VtOUs+gpvR1Phhl9SUnxLzv+7ZEnWNsIr81KkWt50yKNQDeve78PjzGrbEjEa+sNIssd Begg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e13si4852111eja.305.2020.11.27.01.43.48; Fri, 27 Nov 2020 01:44:10 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728741AbgK0Jkm (ORCPT + 99 others); Fri, 27 Nov 2020 04:40:42 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:8601 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727913AbgK0Jkc (ORCPT ); Fri, 27 Nov 2020 04:40:32 -0500 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4Cj8js0sJNzLt3L; Fri, 27 Nov 2020 17:40:01 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.487.0; Fri, 27 Nov 2020 17:40:21 +0800 From: Qinglang Miao To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , "Jernej Skrabec" , David Airlie , "Daniel Vetter" CC: , , Qinglang Miao Subject: [PATCH] drm: bridge: cdns-mhdp8546: fix reference leak in cdns_mhdp_probe Date: Fri, 27 Nov 2020 17:44:37 +0800 Message-ID: <20201127094437.120952-1-miaoqinglang@huawei.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.113.25] 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 a reference leak here. A new function pm_runtime_resume_and_get is introduced in [0] to keep usage counter balanced. So We fix the reference leak by replacing it with new funtion. [0] dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter") Fixes: fb43aa0acdfd ("drm: bridge: Add support for Cadence MHDP8546 DPI/DP bridge") Reported-by: Hulk Robot Signed-off-by: Qinglang Miao --- drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c index d0c65610e..3ee515d21 100644 --- a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +++ b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c @@ -2369,7 +2369,7 @@ static int cdns_mhdp_probe(struct platform_device *pdev) clk_prepare_enable(clk); pm_runtime_enable(dev); - ret = pm_runtime_get_sync(dev); + ret = pm_runtime_resume_and_get(dev); if (ret < 0) { dev_err(dev, "pm_runtime_get_sync failed\n"); pm_runtime_disable(dev); -- 2.23.0