minigbm: populate errno for all code path of drv_bo_create

Error code triaging from drv_bo_create relies on errno. This patch fixes
the missing generation of errno, so that cros_gralloc_driver::allocate
can return the errno on failure.

BUG=b:199524294
TEST=CtsNativeHardwareTestCases

Change-Id: Ie6bf374d1a1c68800463b17ab00a08d859755641
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3163927
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
This commit is contained in:
Yiwei Zhang 2021-09-16 04:47:54 +00:00 committed by Commit Bot
parent 1f9b9000b7
commit 01b697472e

2
drv.c
View file

@ -230,6 +230,7 @@ struct bo *drv_bo_new(struct driver *drv, uint32_t width, uint32_t height, uint3
if (!bo->meta.num_planes) {
free(bo);
errno = EINVAL;
return NULL;
}
@ -263,6 +264,7 @@ struct bo *drv_bo_create(struct driver *drv, uint32_t width, uint32_t height, ui
}
if (ret) {
errno = -ret;
free(bo);
return NULL;
}