[Mesa-dev] [PATCH] st/dri: always initialize 'opencl_func_mutex' in struct dri_screen
Aleksander Morgado
aleksander at aleksander.es
Thu Jul 6 20:28:41 UTC 2017
The 'opencl_func_mutex' is destroyed in dri_destroy_screen_helper()
unconditionally, so make sure it is always initialized to avoid any
undefined behaviour.
Signed-off-by: Aleksander Morgado <aleksander at aleksander.es>
---
src/gallium/state_trackers/dri/dri2.c | 1 +
src/gallium/state_trackers/dri/drisw.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c
index 60ec38d8e4..f089dfbbed 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -2121,6 +2121,7 @@ dri_kms_init_screen(__DRIscreen * sPriv)
screen->sPriv = sPriv;
screen->fd = sPriv->fd;
+ (void) mtx_init(&screen->opencl_func_mutex, mtx_plain);
sPriv->driverPrivate = (void *)screen;
diff --git a/src/gallium/state_trackers/dri/drisw.c b/src/gallium/state_trackers/dri/drisw.c
index 189d61c4cb..83de388b31 100644
--- a/src/gallium/state_trackers/dri/drisw.c
+++ b/src/gallium/state_trackers/dri/drisw.c
@@ -393,6 +393,7 @@ drisw_init_screen(__DRIscreen * sPriv)
screen->sPriv = sPriv;
screen->fd = -1;
+ (void) mtx_init(&screen->opencl_func_mutex, mtx_plain);
swrast_no_present = debug_get_option_swrast_no_present();
--
2.13.1
More information about the mesa-dev
mailing list