[Beignet] [PATCH 8/8] GBE: refine error handling for private libva buffer sharing extension.
Zhigang Gong
zhigang.gong at intel.com
Tue Mar 31 19:05:43 PDT 2015
Signed-off-by: Zhigang Gong <zhigang.gong at intel.com>
---
src/cl_mem.c | 4 ++++
src/intel/intel_driver.c | 7 +++++++
2 files changed, 11 insertions(+)
diff --git a/src/cl_mem.c b/src/cl_mem.c
index 57d27dd..31eb4c1 100644
--- a/src/cl_mem.c
+++ b/src/cl_mem.c
@@ -1974,6 +1974,10 @@ LOCAL cl_mem cl_mem_new_libva_buffer(cl_context ctx,
size_t sz = 0;
mem->bo = cl_buffer_get_buffer_from_libva(ctx, bo_name, &sz);
+ if (mem->bo == NULL) {
+ err = CL_MEM_OBJECT_ALLOCATION_FAILURE;
+ goto error;
+ }
mem->size = sz;
exit:
diff --git a/src/intel/intel_driver.c b/src/intel/intel_driver.c
index ea71cfe..5ed9e13 100644
--- a/src/intel/intel_driver.c
+++ b/src/intel/intel_driver.c
@@ -369,6 +369,10 @@ intel_driver_share_buffer(intel_driver_t *driver, const char *sname, uint32_t na
dri_bo *bo = intel_bo_gem_create_from_name(driver->bufmgr,
sname,
name);
+ if (bo == NULL) {
+ fprintf(stderr, "intel_bo_gem_create_from_name create \"%s\" bo from name %d failed: %s\n", sname, name, strerror(errno));
+ return NULL;
+ }
return bo;
}
@@ -668,6 +672,9 @@ cl_buffer intel_share_buffer_from_libva(cl_context ctx,
intel_bo = intel_driver_share_buffer((intel_driver_t *)ctx->drv, "shared from libva", bo_name);
+ if (intel_bo == NULL)
+ return NULL;
+
if (sz)
*sz = intel_bo->size;
--
1.9.1
More information about the Beignet
mailing list