DORMANTno replies

[PATCH] drm/stm: ltdc: switch to pm_runtime_resume_and_get

From: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>
Date: 2025-09-18 14:33:58
Also in: dri-devel, lkml
Subsystem: drm drivers, drm drivers and misc gpu patches, the rest · Maintainers: David Airlie, Simona Vetter, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, Linus Torvalds

pm_runtime_get_sync() error code is not checked if it fails on clock
enable.  This can lead to an illegal access to the clock peripheral and
cause a system hang on MP1 or a SERC fired on MP2.  By using
pm_runtime_resume_and_get(), the PM counter isn't incremented if an
error occurs and we can return the error code.

Switch from pm_runtime_get_sync() to pm_runtime_resume_and_get() and
check returned error code.

Signed-off-by: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>
---
 drivers/gpu/drm/stm/ltdc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index d1501e86a5b1c3fd5e8791a2143616a66850a62b..5ce3fd205fd7bbfd8735535c0ba4a660d68d02f9 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -779,7 +779,8 @@ static void ltdc_crtc_atomic_enable(struct drm_crtc *crtc,
 
 	drm_dbg_driver(crtc->dev, "\n");
 
-	pm_runtime_get_sync(ddev->dev);
+	if (pm_runtime_resume_and_get(ddev->dev))
+		return;
 
 	/* Sets the background color value */
 	regmap_write(ldev->regmap, LTDC_BCCR, BCCR_BCBLACK);
@@ -941,7 +942,7 @@ static void ltdc_crtc_mode_set_nofb(struct drm_crtc *crtc)
 	}
 
 	if (!pm_runtime_active(ddev->dev)) {
-		ret = pm_runtime_get_sync(ddev->dev);
+		ret = pm_runtime_resume_and_get(ddev->dev);
 		if (ret) {
 			drm_err(crtc->dev, "Failed to set mode, cannot get sync\n");
 			return;
---
base-commit: 0bf37f45d5c472aebdf32da64775cac1110c085c
change-id: 20250918-drm-misc-next-225da9d83998

Best regards,
-- 
Raphael Gallais-Pou [off-list ref]

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help