summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2020-06-18 13:20:41 +1000
committerDave Airlie <airlied@redhat.com>2020-06-18 13:20:41 +1000
commit3c5bb0fccc796faa9d97bc5e4f188fc7ed3ec69a (patch)
tree7891936185e62e11884430a3811df670810e03bd
parent14bd3e600841d72b558cce6b75e4abce327e211d (diff)
zev: fix some apisnonya
-rw-r--r--src/zev/zev_core.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/zev/zev_core.c b/src/zev/zev_core.c
index d76e74d309f..93c33f4a531 100644
--- a/src/zev/zev_core.c
+++ b/src/zev/zev_core.c
@@ -1116,6 +1116,9 @@ static ze_result_t zev_ModuleDestroy(ze_module_handle_t _module)
{
ZEV_FROM_HANDLE(zev_module, module, _module);
+ if (_module == NULL)
+ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE;
+
vkDestroyShaderModule(module->dev->vk_dev, module->module, NULL);
free(module->spec_info);
free(module);
@@ -1228,6 +1231,8 @@ static ze_result_t zev_KernelDestroy(ze_kernel_handle_t _kernel)
{
ZEV_FROM_HANDLE(zev_kernel, kernel, _kernel);
+ if (_kernel == NULL)
+ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE;
vkUnmapMemory(kernel->module->dev->vk_dev, kernel->input_buffer_mem);
vkFreeMemory(kernel->module->dev->vk_dev, kernel->input_buffer_mem, NULL);
@@ -1262,7 +1267,10 @@ static ze_result_t zev_KernelSetArgumentValue(ze_kernel_handle_t _kernel,
uint32_t offset = kernel->input_map[arg_index];
- memcpy(kernel->input_ptr + offset, arg_value, arg_size);
+ if (arg_value)
+ memcpy(kernel->input_ptr + offset, arg_value, arg_size);
+ else
+ memset(kernel->input_ptr + offset, 0, arg_size);
return ZE_RESULT_SUCCESS;
}