[Mesa-dev] st/dri: always initialize 'opencl_func_mutex' in struct dri_screen

Submitted by Aleksander Morgado on July 6, 2017, 8:28 p.m.

Details

Message ID 20170706202842.10214-1-aleksander@aleksander.es
State New
Headers show
Series "st/dri: always initialize 'opencl_func_mutex' in struct dri_screen" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Aleksander Morgado July 6, 2017, 8:28 p.m.
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@aleksander.es>
---
 src/gallium/state_trackers/dri/dri2.c  | 1 +
 src/gallium/state_trackers/dri/drisw.c | 1 +
 2 files changed, 2 insertions(+)

Patch hide | download patch | download mbox

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();
 

Comments

Reviewed-by: Marek Olšák <marek.olsak@amd.com>

Marek

On Thu, Jul 6, 2017 at 10:28 PM, Aleksander Morgado
<aleksander@aleksander.es> wrote:
> 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@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
>