Module Name: src
Committed By: riastradh
Date: Sun Apr 28 15:35:39 UTC 2024
Modified Files:
src/sys/external/bsd/drm2/linux: linux_sync_file.c
Log Message:
linux_sync_file: Fix missing init/fini steps.
Noted by rjs@.
PR kern/58210
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/linux/linux_sync_file.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/external/bsd/drm2/linux/linux_sync_file.c
diff -u src/sys/external/bsd/drm2/linux/linux_sync_file.c:1.2 src/sys/external/bsd/drm2/linux/linux_sync_file.c:1.3
--- src/sys/external/bsd/drm2/linux/linux_sync_file.c:1.2 Sat Feb 12 15:51:29 2022
+++ src/sys/external/bsd/drm2/linux/linux_sync_file.c Sun Apr 28 15:35:39 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_sync_file.c,v 1.2 2022/02/12 15:51:29 thorpej Exp $ */
+/* $NetBSD: linux_sync_file.c,v 1.3 2024/04/28 15:35:39 riastradh Exp $ */
/*-
* Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_sync_file.c,v 1.2 2022/02/12 15:51:29 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_sync_file.c,v 1.3 2024/04/28 15:35:39 riastradh Exp $");
#include <sys/event.h>
#include <sys/fcntl.h>
@@ -51,15 +51,17 @@ sync_file_create(struct dma_fence *fence
sf = kmem_zalloc(sizeof(*sf), KM_SLEEP);
sf->file = fp;
- sf->sf_fence = dma_fence_get(fence);
+
mutex_init(&sf->sf_lock, MUTEX_DEFAULT, IPL_VM);
selinit(&sf->sf_selq);
sf->sf_polling = false;
sf->sf_signalled = false;
+ sf->sf_fence = dma_fence_get(fence);
fp->f_type = DTYPE_MISC;
fp->f_flag = FREAD | FWRITE;
fp->f_ops = &sync_file_ops;
+ fp->f_data = sf;
return sf;
}
@@ -73,6 +75,8 @@ sync_file_close(struct file *fp)
dma_fence_remove_callback(sf->sf_fence, &sf->sf_fcb);
dma_fence_put(sf->sf_fence);
sf->sf_fence = NULL;
+ seldestroy(&sf->sf_selq);
+ mutex_destroy(&sf->sf_lock);
kmem_free(sf, sizeof(*sf));