From a6cce52908e511011aef30222bf9de1ae0b71f0a Mon Sep 17 00:00:00 2001 From: Axel Davy Date: Sun, 28 Mar 2021 18:31:57 +0200 Subject: [PATCH] st/nine: Fix compilation warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Axel Davy Acked-by: Timur Kristóf Part-of: --- .../frontends/nine/nine_memory_helper.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/gallium/frontends/nine/nine_memory_helper.c b/src/gallium/frontends/nine/nine_memory_helper.c index 6cf1fdaa899..1c52a5e0838 100644 --- a/src/gallium/frontends/nine/nine_memory_helper.c +++ b/src/gallium/frontends/nine/nine_memory_helper.c @@ -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;