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:
committed by
Marge Bot
parent
ea23d4f04e
commit
5d0072ae7e
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user