lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Wed,  1 Jun 2022 16:20:50 +0400
From:   Miaoqian Lin <linmq006@...il.com>
To:     Emma Anholt <emma@...olt.net>, David Airlie <airlied@...ux.ie>,
        Daniel Vetter <daniel@...ll.ch>, Eric Anholt <eric@...olt.net>,
        dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Cc:     linmq006@...il.com
Subject: [PATCH v3] drm/v3d/v3d_drv: Fix PM disable depth imbalance

The pm_runtime_enable will increase power disable depth.
If the probe fails, we should use pm_runtime_disable() to balance
pm_runtime_enable().
Also call disable function in remove function.

Fixes: 57692c94dcbe ("drm/v3d: Introduce a new DRM driver for Broadcom V3D V3.x+")
Signed-off-by: Miaoqian Lin <linmq006@...il.com>
---
Changes in v3:
- call pm_runtime_disable() in v3d_platform_drm_remove
- update commit message

Changes in v2
- put pm_runtime_disable before dma_free_wc
- rename dma_free to pm_disable

v1: https://lore.kernel.org/r/20220105120442.14418-1-linmq006@gmail.com
v2: https://lore.kernel.org/r/20220106124657.32737-1-linmq006@gmail.com
---
 drivers/gpu/drm/v3d/v3d_drv.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b/drivers/gpu/drm/v3d/v3d_drv.c
index 1afcd54fbbd5..f3380399fe17 100644
--- a/drivers/gpu/drm/v3d/v3d_drv.c
+++ b/drivers/gpu/drm/v3d/v3d_drv.c
@@ -286,7 +286,7 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
 
 	ret = v3d_gem_init(drm);
 	if (ret)
-		goto dma_free;
+		goto pm_disable;
 
 	ret = v3d_irq_init(v3d);
 	if (ret)
@@ -302,7 +302,8 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
 	v3d_irq_disable(v3d);
 gem_destroy:
 	v3d_gem_destroy(drm);
-dma_free:
+pm_disable:
+	pm_runtime_disable(dev);
 	dma_free_wc(dev, 4096, v3d->mmu_scratch, v3d->mmu_scratch_paddr);
 	return ret;
 }
@@ -316,6 +317,7 @@ static int v3d_platform_drm_remove(struct platform_device *pdev)
 
 	v3d_gem_destroy(drm);
 
+	pm_runtime_disable(&pdev->dev);
 	dma_free_wc(v3d->drm.dev, 4096, v3d->mmu_scratch,
 		    v3d->mmu_scratch_paddr);
 
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ