From d4d91bc5c19a380573e97d57e5feabb59e139baf Mon Sep 17 00:00:00 2001
From: Anders Blomdell <anders.blomdell@control.lth.se>
Date: Tue, 12 Mar 2019 19:16:48 +0100
Subject: [PATCH] Handle return status from comedi_dio_config

---
 plugins/comedi/comedi.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/plugins/comedi/comedi.c b/plugins/comedi/comedi.c
index 423d377..71c089b 100644
--- a/plugins/comedi/comedi.c
+++ b/plugins/comedi/comedi.c
@@ -332,17 +332,17 @@ static struct moberg_status channel_open(struct moberg_channel *channel)
   channel->context->descriptor.max = range->max;
   channel->context->descriptor.delta = (range->max - range->min) / maxdata;
   if (channel->kind == chan_DIGITALIN) {
-    if (comedi_dio_config(channel->context->device->comedi.handle,
-                          channel->context->descriptor.subdevice,
-                          channel->context->descriptor.subchannel,
-                          0)) {
+    if (0 > comedi_dio_config(channel->context->device->comedi.handle,
+                              channel->context->descriptor.subdevice,
+                              channel->context->descriptor.subchannel,
+                              0)) {
       goto err_errno;
     }
   } else if (channel->kind == chan_DIGITALOUT) {
-    if(comedi_dio_config(channel->context->device->comedi.handle,
-                         channel->context->descriptor.subdevice,
-                         channel->context->descriptor.subchannel,
-                         1)) {
+    if (0 > comedi_dio_config(channel->context->device->comedi.handle,
+                              channel->context->descriptor.subdevice,
+                              channel->context->descriptor.subchannel,
+                              1)) {
       goto err_errno;
     }
   }
-- 
GitLab