From patchwork Thu Sep 22 13:21:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Qilong X-Patchwork-Id: 12985114 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 93658C6FA86 for ; Thu, 22 Sep 2022 13:18:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=EKuWc8G/jjVD3XI8W1YJm4OrUGgqJsgcq2fehpqiZO4=; b=fDUd/xH5kXOAJ0 siEOl67aagZ6rNuT1Si8hirCPbLsabAspUVLZRq/XH4T7Ov6d3zW4C5Wz2jLmmuBao7shCKtzjeuX aHkgyors2UsajJuzqvkTtrvOhMOXWLcABJdZ6L88i521mP8PsRKZobAEC5ci8uamOiy80a0RJrDu1 9rvjv75ZHS5TobzG6MBKQgmp5T0LFn1QB3uwU1YhZvonnV3qKg+5EEUjurGDoQDVe2mNf8s0tcxfb 1ZbnGuxmko/BylndGv+dtYEoccEzPZF/faaamI41XG260MPE+ocr+qhuo4Xw+1K1Cksx4dndhGKW/ 4zni9HEH/3nwIAzUK8pw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1obM5N-00FcFj-PY; Thu, 22 Sep 2022 13:17:49 +0000 Received: from szxga02-in.huawei.com ([45.249.212.188]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1obM5K-00FcAI-JK for linux-rockchip@lists.infradead.org; Thu, 22 Sep 2022 13:17:48 +0000 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MYG124Yj8zMpRQ; Thu, 22 Sep 2022 21:12:54 +0800 (CST) Received: from kwepemm600014.china.huawei.com (7.193.23.54) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 22 Sep 2022 21:17:37 +0800 Received: from huawei.com (10.90.53.225) by kwepemm600014.china.huawei.com (7.193.23.54) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 22 Sep 2022 21:17:36 +0800 From: Zhang Qilong To: , , , , , Subject: [PATCH -next 1/2] drm/rockchip: vop: fix PM usage counter unbalance in vop ops Date: Thu, 22 Sep 2022 21:21:06 +0800 Message-ID: <20220922132107.105419-2-zhangqilong3@huawei.com> X-Mailer: git-send-email 2.26.0.106.g9fadedd In-Reply-To: <20220922132107.105419-1-zhangqilong3@huawei.com> References: <20220922132107.105419-1-zhangqilong3@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.225] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600014.china.huawei.com (7.193.23.54) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220922_061746_855704_536EE0CA X-CRM114-Status: UNSURE ( 9.50 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=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. We fix it by replacing it with the newest pm_runtime_resume_and_get to keep usage counter balanced. Fixes:5e570373c015b ("drm/rockchip: vop: Enable pm domain before vop_initial") Fixes:604be85547ce4 ("drm/rockchip: Add VOP2 driver") Signed-off-by: Zhang Qilong --- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index c356de5dd220..fa1f4ee6d195 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -602,7 +602,7 @@ static int vop_enable(struct drm_crtc *crtc, struct drm_crtc_state *old_state) struct vop *vop = to_vop(crtc); int ret, i; - ret = pm_runtime_get_sync(vop->dev); + ret = pm_runtime_resume_and_get(vop->dev); if (ret < 0) { DRM_DEV_ERROR(vop->dev, "failed to get pm runtime: %d\n", ret); return ret; @@ -1983,7 +1983,7 @@ static int vop_initial(struct vop *vop) return PTR_ERR(vop->dclk); } - ret = pm_runtime_get_sync(vop->dev); + ret = pm_runtime_resume_and_get(vop->dev); if (ret < 0) { DRM_DEV_ERROR(vop->dev, "failed to get pm runtime: %d\n", ret); return ret;