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:
Yiwei Zhang 2025-10-13 21:49:26 -07:00 committed by Marge Bot
parent 49cdf9f0d5
commit 6c2de971c1
2 changed files with 6 additions and 2 deletions

View file

@ -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;
}
}
}

View file

@ -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;
}