mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-23 16:00:41 +02:00
panvk: improve error propagation in panvk_pool_upload_aligned
Instead of crashing with segfault within upload_shader_desc_info, allow the caller to handle the alloc failure (they already do). Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37861>
This commit is contained in:
parent
49cdf9f0d5
commit
6c2de971c1
2 changed files with 6 additions and 2 deletions
|
|
@ -98,8 +98,10 @@ panvk_pool_alloc_backing(struct panvk_pool *pool, size_t sz)
|
|||
* VK_ERROR_OUT_OF_HOST_MEMORY.
|
||||
* We expect the caller to check the returned pointer and catch the
|
||||
* host allocation failure with a call to panvk_error(). */
|
||||
if (result == VK_ERROR_OUT_OF_HOST_MEMORY)
|
||||
if (result == VK_ERROR_OUT_OF_HOST_MEMORY) {
|
||||
assert(bo == NULL);
|
||||
errno = -ENOMEM;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -209,7 +209,9 @@ panvk_pool_upload_aligned(struct panvk_pool *pool, const void *data, size_t sz,
|
|||
};
|
||||
|
||||
struct panvk_priv_mem mem = panvk_pool_alloc_mem(pool, info);
|
||||
memcpy(panvk_priv_mem_host_addr(mem), data, sz);
|
||||
void *host_addr = panvk_priv_mem_host_addr(mem);
|
||||
if (likely(host_addr != NULL))
|
||||
memcpy(host_addr, data, sz);
|
||||
return mem;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue