From 4964c61f4b248e9eb16e8eadb5f5d0b6410b6b84 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 22 Jul 2010 11:32:08 +1000 Subject: Return BadMatch for already configured devices. PreInit can now return different error codes. Return BadAlloc for alloc failures and BadMatch if the device was already configured or the cache comparison/probe failed. Signed-off-by: Peter Hutterer --- src/evdev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/evdev.c b/src/evdev.c index 882ca7b..851ae8d 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -2079,6 +2079,7 @@ EvdevPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) #endif { EvdevPtr pEvdev; + int rc = BadAlloc; if (!(pEvdev = calloc(sizeof(EvdevRec), 1))) goto error; @@ -2110,6 +2111,7 @@ EvdevPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) { xf86Msg(X_WARNING, "%s: Device may already be configured.\n", pInfo->name); + rc = BadMatch; goto error; } @@ -2117,6 +2119,7 @@ EvdevPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) if (EvdevCacheCompare(pInfo, FALSE) || EvdevProbe(pInfo)) { + rc = BadMatch; goto error; } @@ -2134,7 +2137,7 @@ EvdevPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) error: if (pInfo->fd >= 0) close(pInfo->fd); - return BadAlloc; + return rc; } _X_EXPORT InputDriverRec EVDEV = { -- cgit v1.2.3