fix: clover: warning: ignoring return value of ‘int posix_memalign(…)’ [-Wunused-result]
During builds GCC 13.2 issues the following warning:
src/gallium/frontends/clover/api/memory.cpp:612:21: warning: ignoring return value of ‘int posix_memalign(void**, size_t, size_t)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
612 | posix_memalign(&ptr, alignment, size);
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
Fix this by checking the returned value is actually 0 and if not we now
report a nullptr.
Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25724>
This commit is contained in:
parent
10e3de37bf
commit
2320ad1da6
1 changed files with 3 additions and 1 deletions
|
|
@ -609,7 +609,9 @@ clSVMAlloc(cl_context d_ctx,
|
|||
void *ptr = nullptr;
|
||||
if (alignment < sizeof(void*))
|
||||
alignment = sizeof(void*);
|
||||
posix_memalign(&ptr, alignment, size);
|
||||
int ret = posix_memalign(&ptr, alignment, size);
|
||||
if (ret)
|
||||
return nullptr;
|
||||
|
||||
if (ptr)
|
||||
ctx.add_svm_allocation(ptr, size);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue