[PATCH synaptics] Return true/false from SetDeviceAndProtocol

Peter Hutterer peter.hutterer at who-t.net
Tue Nov 29 15:40:47 PST 2011


Instead of requiring the caller to know which private field indicates
failure, just return true on success or false on failure.

No functional change.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/synaptics.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/synaptics.c b/src/synaptics.c
index 1c9b6db..8fbddc8 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -265,7 +265,7 @@ SanitizeDimensions(InputInfoPtr pInfo)
     }
 }
 
-static void
+static Bool
 SetDeviceAndProtocol(InputInfoPtr pInfo)
 {
     SynapticsPrivate *priv = pInfo->private;
@@ -286,6 +286,8 @@ SetDeviceAndProtocol(InputInfoPtr pInfo)
     free(device);
 
     priv->proto_ops = protocols[i].proto_ops;
+
+    return (priv->proto_ops != NULL);
 }
 
 /*
@@ -714,8 +716,7 @@ SynapticsPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
     }
 
     /* may change pInfo->options */
-    SetDeviceAndProtocol(pInfo);
-    if (priv->proto_ops == NULL) {
+    if (!SetDeviceAndProtocol(pInfo)) {
         xf86IDrvMsg(pInfo, X_ERROR, "Synaptics driver unable to detect protocol\n");
         goto SetupProc_fail;
     }
-- 
1.7.7.1


More information about the xorg-devel mailing list