Mesa (master): microsoft/clc: Fix const violations from ralloc_steal
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Jan 4 22:13:37 UTC 2021
Module: Mesa
Branch: master
Commit: dcd8adcc2892f39534bd9305b1e2e12bd786f434
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=dcd8adcc2892f39534bd9305b1e2e12bd786f434
Author: Jesse Natalie <jenatali at microsoft.com>
Date: Thu Nov 19 14:44:08 2020 -0800
microsoft/clc: Fix const violations from ralloc_steal
Fixes: ff05da7f8dc ("microsoft: Add CLC frontend and kernel/compute support to DXIL converter")
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7697>
---
src/microsoft/clc/clc_compiler.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/microsoft/clc/clc_compiler.c b/src/microsoft/clc/clc_compiler.c
index 15b1380293c..8cea38272cc 100644
--- a/src/microsoft/clc/clc_compiler.c
+++ b/src/microsoft/clc/clc_compiler.c
@@ -515,8 +515,8 @@ clc_context_new(const struct clc_logger *logger, const struct clc_context_option
if (options && options->optimize)
clc_context_optimize(s);
+ ralloc_steal(ctx, s);
ctx->libclc_nir = s;
- ralloc_steal(ctx, ctx->libclc_nir);
return ctx;
}
@@ -559,13 +559,14 @@ struct clc_context *
struct blob_reader tmp;
blob_reader_init(&tmp, serialized, serialized_size);
- ctx->libclc_nir = nir_deserialize(NULL, libclc_nir_options, &tmp);
- if (!ctx->libclc_nir) {
- free(ctx);
+ nir_shader *s = nir_deserialize(NULL, libclc_nir_options, &tmp);
+ if (!s) {
+ ralloc_free(ctx);
return NULL;
}
- ralloc_steal(ctx, ctx->libclc_nir);
+ ralloc_steal(ctx, s);
+ ctx->libclc_nir = s;
return ctx;
}
More information about the mesa-commit
mailing list