summaryrefslogtreecommitdiff
authorPeter Hutterer <peter.hutterer@who-t.net>2008-12-22 23:59:28 (GMT)
committer Peter Hutterer <peter.hutterer@who-t.net>2009-01-05 01:05:13 (GMT)
commit27011254c4de4e573a0851bf46892fb488db6522 (patch) (side-by-side diff)
tree859b9f68bd61d7854edbeb27537d2fa12cc27486
parente1a3a1a0d85c9971aea65c2228b5fd4dbf3bf57a (diff)
downloadxserver-27011254c4de4e573a0851bf46892fb488db6522.zip
xserver-27011254c4de4e573a0851bf46892fb488db6522.tar.gz
xfree86: If an input device failed to activate, return immediately.
Devices are only activated once - right after they've been added to the server. If a device failes activation, it's dead. There's no reason to continue. Return the error code from ActivateDevice() without setting up sprite information or even sending a event to the client. Then - in the DDX - just remove the device again. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--dix/devices.c2
-rw-r--r--hw/xfree86/common/xf86Xinput.c5
2 files changed, 6 insertions, 1 deletions
diff --git a/dix/devices.c b/dix/devices.c
index ff6f0ec..c51d9be 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -444,6 +444,8 @@ ActivateDevice(DeviceIntPtr dev)
ret = (*dev->deviceProc) (dev, DEVICE_INIT);
dev->inited = (ret == Success);
+ if (!dev->inited)
+ return ret;
/* Initialize memory for sprites. */
if (dev->isMaster && dev->spriteInfo->spriteOwner)
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index e39c087..e8acf39 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -546,7 +546,10 @@ xf86NewInputDevice(IDevPtr idev, DeviceIntPtr *pdev, BOOL enable)
}
dev = pInfo->dev;
- ActivateDevice(dev);
+ rval = ActivateDevice(dev);
+ if (rval != Success)
+ goto unwind;
+
/* Enable it if it's properly initialised and we're currently in the VT */
if (enable && dev->inited && dev->startup && xf86Screens[0]->vtSema)
{