pan/kmod: fix propagation of MAP_FAILED in pan_kmod_bo_mmap

All current callers check for MAP_FAILED, not NULL, and we are returning
MAP_FAILED already on the other error paths.

Fixes: d5f4f918f3 ("panfrost: clean up mmap-diagnostics")
Signed-off-by: Olivia Lee <olivia.lee@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36122>
(cherry picked from commit 77f7147cea)
This commit is contained in:
Olivia Lee 2025-07-14 11:47:48 -07:00 committed by Eric Engestrom
parent 331a5c7646
commit 6a2ba45e71
2 changed files with 2 additions and 4 deletions

View file

@ -194,7 +194,7 @@
"description": "pan/kmod: fix propagation of MAP_FAILED in pan_kmod_bo_mmap",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "d5f4f918f37491fd9fd944230dd047575a53b24b",
"notes": null

View file

@ -625,11 +625,9 @@ pan_kmod_bo_mmap(struct pan_kmod_bo *bo, off_t bo_offset, size_t size, int prot,
host_addr = os_mmap(host_addr, size, prot, flags, bo->dev->fd,
mmap_offset + bo_offset);
if (host_addr == MAP_FAILED) {
if (host_addr == MAP_FAILED)
mesa_loge("mmap(..., size=%zu, prot=%d, flags=0x%x) failed: %s",
size, prot, flags, strerror(errno));
return NULL;
}
return host_addr;
}