diff mbox series

[1/6] drm/syncobj: Avoid double memset in drm_syncobj_find_fence

Message ID 20250102194418.70383-2-tursulin@igalia.com (mailing list archive)
State New
Headers show
Series A few drm_syncobj optimisations | expand

Commit Message

Tvrtko Ursulin Jan. 2, 2025, 7:44 p.m. UTC
From: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>

On kernels hardened with CONFIG_INIT_STACK_ALL_ZERO we can avoid the
double memset by moving the memory clearing to the declaration block. That
way the compiler can notice and only emit it once.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
---
 drivers/gpu/drm/drm_syncobj.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
index 4f2ab8a7b50f..49cda394db5b 100644
--- a/drivers/gpu/drm/drm_syncobj.c
+++ b/drivers/gpu/drm/drm_syncobj.c
@@ -437,8 +437,8 @@  int drm_syncobj_find_fence(struct drm_file *file_private,
 			   struct dma_fence **fence)
 {
 	struct drm_syncobj *syncobj = drm_syncobj_find(file_private, handle);
-	struct syncobj_wait_entry wait;
 	u64 timeout = nsecs_to_jiffies64(DRM_SYNCOBJ_WAIT_FOR_SUBMIT_TIMEOUT);
+	struct syncobj_wait_entry wait = { };
 	int ret;
 
 	if (flags & ~DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT)
@@ -479,7 +479,6 @@  int drm_syncobj_find_fence(struct drm_file *file_private,
 	if (!(flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT))
 		goto out;
 
-	memset(&wait, 0, sizeof(wait));
 	wait.task = current;
 	wait.point = point;
 	drm_syncobj_fence_add_wait(syncobj, &wait);