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>
diff --git a/drv.c b/drv.c
index 254922d..f2274c1 100644
--- a/drv.c
+++ b/drv.c
@@ -230,6 +230,7 @@
if (!bo->meta.num_planes) {
free(bo);
+ errno = EINVAL;
return NULL;
}
@@ -263,6 +264,7 @@
}
if (ret) {
+ errno = -ret;
free(bo);
return NULL;
}