xserver: Branch 'master'
Matthias Hopf
mhopf at kemper.freedesktop.org
Thu Nov 16 18:29:33 EET 2006
hw/xfree86/os-support/bus/linuxPci.c | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
New commits:
diff-tree ae3c9ad4abe66784d7ee474455003d2745699286 (from 2eab230d9bd3f73ffe1b5a42111f89e85904ee11)
Author: Bjorn Helgaas <bjorn.helgaas at hp.com>
Date: Thu Nov 16 17:29:06 2006 +0100
Bug 9041: Check the return code in xf86MapDomainMemory().
diff --git a/hw/xfree86/os-support/bus/linuxPci.c b/hw/xfree86/os-support/bus/linuxPci.c
index 15fc2b8..03388f1 100644
--- a/hw/xfree86/os-support/bus/linuxPci.c
+++ b/hw/xfree86/os-support/bus/linuxPci.c
@@ -683,28 +683,28 @@ xf86MapDomainMemory(int ScreenNum, int F
ADDRESS Base, unsigned long Size)
{
int domain = xf86GetPciDomain(Tag);
- int fd;
+ int fd = -1;
pointer addr;
/*
* We use /proc/bus/pci on non-legacy addresses or if the Linux sysfs
* legacy_mem interface is unavailable.
*/
- if (Base > 1024*1024)
- return linuxMapPci(ScreenNum, Flags, Tag, Base, Size,
+ if (Base >= 1024*1024)
+ addr = linuxMapPci(ScreenNum, Flags, Tag, Base, Size,
PCIIOC_MMAP_IS_MEM);
-
- if ((fd = linuxOpenLegacy(Tag, "legacy_mem")) < 0)
- return linuxMapPci(ScreenNum, Flags, Tag, Base, Size,
+ else if ((fd = linuxOpenLegacy(Tag, "legacy_mem")) < 0)
+ addr = linuxMapPci(ScreenNum, Flags, Tag, Base, Size,
PCIIOC_MMAP_IS_MEM);
+ else
+ addr = mmap(NULL, Size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, Base);
- addr = mmap(NULL, Size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, Base);
- if (addr == MAP_FAILED) {
- close (fd);
+ if (fd >= 0)
+ close(fd);
+ if (addr == NULL || addr == MAP_FAILED) {
perror("mmap failure");
FatalError("xf86MapDomainMem(): mmap() failure\n");
}
- close(fd);
return addr;
}
More information about the xorg-commit
mailing list