panvk: Don't reset errno in panvk_kmod_zalloc()

We shouldn't reset errno when the allocation succeeds, otherwise we might
be overriding previous allocation failures.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31382>
This commit is contained in:
Boris Brezillon
2024-09-27 09:11:39 +02:00
committed by Marge Bot
parent ea23d4f04e
commit 5d0072ae7e
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -118,7 +118,8 @@ panvk_kmod_zalloc(const struct pan_kmod_allocator *allocator, size_t size,
/* We force errno to -ENOMEM on host allocation failures so we can properly
* report it back as VK_ERROR_OUT_OF_HOST_MEMORY. */
errno = obj ? 0 : -ENOMEM;
if (!obj)
errno = -ENOMEM;
return obj;
}
+2 -1
View File
@@ -42,7 +42,8 @@ panvk_kmod_zalloc(const struct pan_kmod_allocator *allocator, size_t size,
/* We force errno to -ENOMEM on host allocation failures so we can properly
* report it back as VK_ERROR_OUT_OF_HOST_MEMORY. */
errno = obj ? 0 : -ENOMEM;
if (!obj)
errno = -ENOMEM;
return obj;
}