OSDN Git Service

Use native_handle functions
authorRob Herring <robh@kernel.org>
Wed, 25 Oct 2017 18:41:54 +0000 (13:41 -0500)
committerRob Herring <robh@kernel.org>
Wed, 29 Nov 2017 16:22:22 +0000 (10:22 -0600)
Use native_handle_{create,delete} functions instead of the C++
alloc/free. This will do the initialization for us instead of open
coding it.

Change-Id: I285292770ca756c1d2c2effa5c73e252526bae0c
Signed-off-by: Rob Herring <robh@kernel.org>
gralloc_gbm.cpp

index aeac898..cfabdf0 100644 (file)
@@ -341,14 +341,10 @@ static struct gralloc_gbm_handle_t *create_bo_handle(int width,
 {
        struct gralloc_gbm_handle_t *handle;
 
-       handle = new gralloc_gbm_handle_t();
+       handle = (gralloc_gbm_handle_t *)native_handle_create(GRALLOC_GBM_HANDLE_NUM_FDS, GRALLOC_GBM_HANDLE_NUM_INTS);
        if (!handle)
                return NULL;
 
-       handle->base.version = sizeof(handle->base);
-       handle->base.numInts = GRALLOC_GBM_HANDLE_NUM_INTS;
-       handle->base.numFds = GRALLOC_GBM_HANDLE_NUM_FDS;
-
        handle->magic = GRALLOC_GBM_HANDLE_MAGIC;
        handle->width = width;
        handle->height = height;
@@ -374,7 +370,7 @@ struct gralloc_gbm_handle_t *gralloc_gbm_bo_create(struct gbm_device *gbm,
 
        bo = gbm_alloc(gbm, handle);
        if (!bo) {
-               delete handle;
+               native_handle_delete(&handle->base);
                return NULL;
        }