[Mesa-dev] [PATCH] gallium/winsys/kms: don't unmap what wasn't mapped

Ray Strode rstrode at redhat.com
Fri Aug 17 12:21:40 UTC 2018


hi,

On Thu, Aug 16, 2018, 4:48 PM Lepton Wu <lepton at chromium.org> wrote:
>
> Does https://patchwork.freedesktop.org/patch/238931/ already fix this?
> What's the advantage to use MAP_FAILED instead of NULL?

yea that patch should work fine, i didnt see it go by.

the advantage of MAP_FAILED is it's more fault tolerant. if you
accidentally try to munmap MAP_FAILED, it will fail right away instead
of succeed and make other unrelated parts of the program crash
mysteriously like NULL would.

There are some use cases for mapping near 0x0 dealing with hardware
i/o too i think.

anyway using the same value mmap returns on failure makes sense from a
symmetry point of view.

It doesn't practically matter though. the other patch should work fine.

--Ray


More information about the mesa-dev mailing list