From 01b697472eb904ecbeba65ee7153b8fed811a960 Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Thu, 16 Sep 2021 04:47:54 +0000 Subject: [PATCH] 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 Reviewed-by: Gurchetan Singh Commit-Queue: Yiwei Zhang --- drv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drv.c b/drv.c index 254922d..f2274c1 100644 --- a/drv.c +++ b/drv.c @@ -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; }