Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
if (read(fd, readbuf, 2 * sizeof(char)) != 2) {
syslog(LOG_ERR, "iio: Failed to read a sensible value from sysfs");
free(str);
if (read(fd, readbuf, 2 * sizeof(char)) != 2) {
syslog(LOG_ERR, "iio: Failed to read a sensible value from sysfs");
free(str);
+ close(fd);
+ closedir(dir);
return -1;
}
chan->enabled = (int) strtol(readbuf, NULL, 10);
return -1;
}
chan->enabled = (int) strtol(readbuf, NULL, 10);
+ closedir(dir);
+ return MRAA_SUCCESS;
+
+ return MRAA_ERROR_INVALID_HANDLE;