dev_num = find_type_by_name(device_name, "iio:device");
if (dev_num < 0) {
printf("Failed to find the %s\n", device_name);
- ret = dev_num;
- goto error_ret;
+ return dev_num;
}
printf("iio device number being used is %d\n", dev_num);
free(trigger_name);
error_free_dev_dir_name:
free(dev_dir_name);
-error_ret:
+
return ret;
}
device_name, dev_num);
ret = asprintf(&chrdev_name, "/dev/iio:device%d", dev_num);
if (ret < 0) {
- ret = -ENOMEM;
- goto error_ret;
+ return -ENOMEM;
}
} else {
/* If we can't find a IIO device by name assume device_name is a
error_free_chrdev_name:
free(chrdev_name);
-error_ret:
+
return ret;
}
const struct dirent *ent;
ret = asprintf(&scan_el_dir, FORMAT_SCAN_ELEMENTS_DIR, device_dir);
- if (ret < 0) {
- ret = -ENOMEM;
- goto error_ret;
- }
+ if (ret < 0)
+ return -ENOMEM;
+
ret = asprintf(&builtname, FORMAT_TYPE_FILE, name);
if (ret < 0) {
ret = -ENOMEM;
free(builtname);
error_free_scan_el_dir:
free(scan_el_dir);
-error_ret:
+
return ret;
}
const struct dirent *ent;
ret = asprintf(&builtname, "%s_%s", name, param_name);
- if (ret < 0) {
- ret = -ENOMEM;
- goto error_ret;
- }
+ if (ret < 0)
+ return -ENOMEM;
+
ret = asprintf(&builtname_generic,
"%s_%s", generic_name, param_name);
if (ret < 0) {
free(builtname_generic);
error_free_builtname:
free(builtname);
-error_ret:
+
return ret;
}
*counter = 0;
ret = asprintf(&scan_el_dir, FORMAT_SCAN_ELEMENTS_DIR, device_dir);
- if (ret < 0) {
- ret = -ENOMEM;
- goto error_ret;
- }
+ if (ret < 0)
+ return -ENOMEM;
+
dp = opendir(scan_el_dir);
if (dp == NULL) {
ret = -errno;
error_free_name:
free(scan_el_dir);
-error_ret:
+
return ret;
}