st/nine: Fix compilation warnings
Signed-off-by: Axel Davy <davyaxel0@gmail.com> Acked-by: Timur Kristóf <timur.kristof@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>
This commit is contained in:
@@ -535,16 +535,13 @@ nine_memfd_unmap_region(struct nine_allocator *allocator,
|
||||
struct nine_memfd_file *memfd_file,
|
||||
struct nine_memfd_file_region *region)
|
||||
{
|
||||
int error;
|
||||
DBG("Unmapping memfd mapped region at %d: size: %d, map=%p, locks=%d, weak=%d\n",
|
||||
region->offset, region->size, region->map,
|
||||
region->num_locks, region->num_weak_unlocks);
|
||||
assert(region->map != NULL);
|
||||
|
||||
if (munmap(region->map, region->size) != 0) {
|
||||
error = errno;
|
||||
fprintf(stderr, "Error on unmapping, errno=%d\n", error);
|
||||
}
|
||||
if (munmap(region->map, region->size) != 0)
|
||||
fprintf(stderr, "Error on unmapping, errno=%d\n", (int)errno);
|
||||
|
||||
region->map = NULL;
|
||||
/* Move from one of the mapped region list to the unmapped one */
|
||||
@@ -661,7 +658,6 @@ nine_memfd_files_unmap(struct nine_allocator *allocator,
|
||||
static bool
|
||||
nine_memfd_region_map(struct nine_allocator *allocator, struct nine_memfd_file *memfd_file, struct nine_memfd_file_region *region)
|
||||
{
|
||||
int error;
|
||||
if (region->map != NULL)
|
||||
return true;
|
||||
|
||||
@@ -676,8 +672,7 @@ nine_memfd_region_map(struct nine_allocator *allocator, struct nine_memfd_file *
|
||||
buf = mmap(NULL, region->size, PROT_READ | PROT_WRITE, MAP_SHARED, memfd_file->fd, region->offset);
|
||||
}
|
||||
if (buf == MAP_FAILED) {
|
||||
error = errno;
|
||||
DBG("Failed to mmap a memfd file, errno=%d\n", error);
|
||||
DBG("Failed to mmap a memfd file, errno=%d\n", (int)errno);
|
||||
return false;
|
||||
}
|
||||
region->map = buf;
|
||||
@@ -696,8 +691,6 @@ nine_memfd_allocator(struct nine_allocator *allocator,
|
||||
{
|
||||
struct nine_memfd_file *memfd_file;
|
||||
struct nine_memfd_file_region *region;
|
||||
int error;
|
||||
|
||||
|
||||
allocation_size = DIVUP(allocation_size, allocator->page_size) * allocator->page_size;
|
||||
new_allocation->allocation_type = NINE_MEMFD_ALLOC;
|
||||
@@ -723,15 +716,13 @@ nine_memfd_allocator(struct nine_allocator *allocator,
|
||||
|
||||
memfd_file->fd = memfd_create("gallium_nine_ram", 0);
|
||||
if (memfd_file->fd == -1) {
|
||||
error = errno;
|
||||
DBG("Failed to created a memfd file, errno=%d\n", error);
|
||||
DBG("Failed to created a memfd file, errno=%d\n", (int)errno);
|
||||
allocator->num_fd--;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ftruncate(memfd_file->fd, memfd_file->filesize) != 0) {
|
||||
error = errno;
|
||||
DBG("Failed to resize a memfd file, errno=%d\n", error);
|
||||
DBG("Failed to resize a memfd file, errno=%d\n", (int)errno);
|
||||
close(memfd_file->fd);
|
||||
allocator->num_fd--;
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user