Skip to content

Commit 1bafff0

Browse files
LuizOt31rodrigovivi
authored andcommitted
drm/i915: Change mutex initialization in intel_guc_log
The intel_guc_log->relay.lock is currently initialized in intel_guc_log_init_early(), but it lacks a corresponding destructor, which can lead to a memory leak. This patch replaces the use of mutex_init() with drmm_mutex_init(), which ensures the lock is properly destroyed when the driver is unloaded. Signed-off-by: Luiz Otavio Mello <[email protected]> Reviewed-by: Rodrigo Vivi <[email protected]> Link: https://lore.kernel.org/r/[email protected] Acked-by: Tvrtko Ursulin <[email protected]> Signed-off-by: Rodrigo Vivi <[email protected]>
1 parent 793d316 commit 1bafff0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/gpu/drm/i915/gt/uc/intel_guc_log.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#include <linux/debugfs.h>
77
#include <linux/string_helpers.h>
88

9+
#include <drm/drm_managed.h>
10+
911
#include "gt/intel_gt.h"
1012
#include "i915_drv.h"
1113
#include "i915_irq.h"
@@ -512,7 +514,10 @@ static void guc_log_relay_unmap(struct intel_guc_log *log)
512514

513515
void intel_guc_log_init_early(struct intel_guc_log *log)
514516
{
515-
mutex_init(&log->relay.lock);
517+
struct intel_guc *guc = log_to_guc(log);
518+
struct drm_i915_private *i915 = guc_to_i915(guc);
519+
520+
drmm_mutex_init(&i915->drm, &log->relay.lock);
516521
INIT_WORK(&log->relay.flush_work, copy_debug_logs_work);
517522
log->relay.started = false;
518523
}

0 commit comments

Comments
 (0)