aio.c: check aio_get_valid_fp return value
authorBrendan Le Foll <brendan.le.foll@intel.com>
Wed, 26 Nov 2014 13:30:10 +0000 (13:30 +0000)
committerBrendan Le Foll <brendan.le.foll@intel.com>
Wed, 26 Nov 2014 13:30:10 +0000 (13:30 +0000)
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
src/aio/aio.c

index f871fbb..f728863 100644 (file)
@@ -121,7 +121,10 @@ mraa_aio_read(mraa_aio_context dev)
     unsigned int shifter_value = 0;
 
     if (dev->adc_in_fp == -1) {
-        aio_get_valid_fp(dev);
+        if (aio_get_valid_fp(dev) != MRAA_SUCCESS) {
+            syslog(LOG_ERR, "aio: Failed to get to the device");
+            return 0;
+        }
     }
 
     lseek(dev->adc_in_fp, 0, SEEK_SET);