diff mbox series

[PATCHv3] drm/xe/display: check for error on drmm_mutex_init

Message ID 20240403140105.1306622-1-arun.r.murthy@intel.com (mailing list archive)
State New, archived
Headers show
Series [PATCHv3] drm/xe/display: check for error on drmm_mutex_init | expand

Commit Message

Arun R Murthy April 3, 2024, 2:01 p.m. UTC
Check return value for drmm_mutex_init as it can fail and return on
failure.

v2: Removed nested if (Lucas)
v3: Revert back to nested if (Andi)

Signed-off-by: Arun R Murthy <arun.r.murthy@intel.com>
---
 drivers/gpu/drm/xe/display/xe_display.c | 30 ++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/xe/display/xe_display.c b/drivers/gpu/drm/xe/display/xe_display.c
index e4db069f0db3..04b83ca5168c 100644
--- a/drivers/gpu/drm/xe/display/xe_display.c
+++ b/drivers/gpu/drm/xe/display/xe_display.c
@@ -107,12 +107,30 @@  int xe_display_create(struct xe_device *xe)
 
 	xe->display.hotplug.dp_wq = alloc_ordered_workqueue("xe-dp", 0);
 
-	drmm_mutex_init(&xe->drm, &xe->sb_lock);
-	drmm_mutex_init(&xe->drm, &xe->display.backlight.lock);
-	drmm_mutex_init(&xe->drm, &xe->display.audio.mutex);
-	drmm_mutex_init(&xe->drm, &xe->display.wm.wm_mutex);
-	drmm_mutex_init(&xe->drm, &xe->display.pps.mutex);
-	drmm_mutex_init(&xe->drm, &xe->display.hdcp.hdcp_mutex);
+	err = drmm_mutex_init(&xe->drm, &xe->sb_lock);
+	if (err)
+		return err;
+
+	err = drmm_mutex_init(&xe->drm, &xe->display.backlight.lock);
+	if (err)
+		return err;
+
+	err = drmm_mutex_init(&xe->drm, &xe->display.audio.mutex);
+	if (err)
+		return err;
+
+	err = drmm_mutex_init(&xe->drm, &xe->display.wm.wm_mutex);
+	if (err)
+		return err;
+
+	err = drmm_mutex_init(&xe->drm, &xe->display.pps.mutex);
+	if (err)
+		return err;
+
+	err = drmm_mutex_init(&xe->drm, &xe->display.hdcp.hdcp_mutex);
+	if (err)
+		return err;
+
 	xe->enabled_irq_mask = ~0;
 
 	err = drmm_add_action_or_reset(&xe->drm, display_destroy, NULL);