OSDN Git Service

Let gbm_free() return a value
authorChih-Wei Huang <cwhuang@linux.org.tw>
Mon, 14 Jan 2019 05:13:50 +0000 (13:13 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Mon, 14 Jan 2019 05:13:50 +0000 (13:13 +0800)
So that gralloc_gbm_handle_unregister() could return correct value
required by gralloctest.

Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
gralloc_gbm.cpp
gralloc_gbm_priv.h

index d4f4bca..3ac2abc 100644 (file)
@@ -238,15 +238,16 @@ static struct gbm_bo *gbm_alloc(struct gbm_device *gbm,
        return bo;
 }
 
-void gbm_free(buffer_handle_t handle)
+int gbm_free(buffer_handle_t handle)
 {
        struct gbm_bo *bo = gralloc_gbm_bo_from_handle(handle);
 
        if (!bo)
-               return;
+               return -EINVAL;
 
        gbm_bo_handle_map.erase(handle);
        gbm_bo_destroy(bo);
+       return 0;
 }
 
 /*
@@ -355,9 +356,7 @@ int gralloc_gbm_handle_register(buffer_handle_t _handle, struct gbm_device *gbm)
  */
 int gralloc_gbm_handle_unregister(buffer_handle_t handle)
 {
-       gbm_free(handle);
-
-       return 0;
+       return gbm_free(handle);
 }
 
 /*
index c0edb6b..a48d89e 100644 (file)
@@ -37,7 +37,7 @@ int gralloc_gbm_handle_unregister(buffer_handle_t handle);
 
 buffer_handle_t gralloc_gbm_bo_create(struct gbm_device *gbm,
                int width, int height, int format, int usage, int *stride);
-void gbm_free(buffer_handle_t handle);
+int gbm_free(buffer_handle_t handle);
 
 struct gbm_bo *gralloc_gbm_bo_from_handle(buffer_handle_t handle);
 buffer_handle_t gralloc_gbm_bo_get_handle(struct gbm_bo *bo);