/* Attempt to open non blocking the access dev */
fp = open(buffer_access, O_RDONLY | O_NONBLOCK);
if (fp == -1) { /* If it isn't there make the node */
- printf("Failed to open %s\n", buffer_access);
ret = -errno;
+ printf("Failed to open %s\n", buffer_access);
goto error_free_buffer_access;
}
fd = open(chrdev_name, 0);
if (fd == -1) {
- fprintf(stdout, "Failed to open %s\n", chrdev_name);
ret = -errno;
+ fprintf(stdout, "Failed to open %s\n", chrdev_name);
goto error_free_chrdev_name;
}
close(fd);
if (ret == -1 || event_fd == -1) {
- fprintf(stdout, "Failed to retrieve event fd\n");
ret = -errno;
+ fprintf(stdout, "Failed to retrieve event fd\n");
goto error_free_chrdev_name;
}
printf("nothing available\n");
continue;
} else {
- perror("Failed to read event from device");
ret = -errno;
+ perror("Failed to read event from device");
break;
}
}
}
sysfsfp = fopen(filename, "r");
if (sysfsfp == NULL) {
- printf("failed to open %s\n", filename);
ret = -errno;
+ printf("failed to open %s\n", filename);
goto error_free_filename;
}
bits_used,
&padint, shift);
if (ret < 0) {
- printf("failed to pass scan type description\n");
ret = -errno;
+ printf("failed to pass scan type description\n");
goto error_close_sysfsfp;
}
*be = (endianchar == 'b');
}
sysfsfp = fopen(filename, "r");
if (sysfsfp == NULL) {
- free(filename);
ret = -errno;
+ free(filename);
count--;
goto error_cleanup_array;
}
sprintf(temp, "%s/%s", basedir, filename);
sysfsfp = fopen(temp, "w");
if (sysfsfp == NULL) {
- printf("failed to open %s\n", temp);
ret = -errno;
+ printf("failed to open %s\n", temp);
goto error_free;
}
fprintf(sysfsfp, "%d", val);
if (verify) {
sysfsfp = fopen(temp, "r");
if (sysfsfp == NULL) {
- printf("failed to open %s\n", temp);
ret = -errno;
+ printf("failed to open %s\n", temp);
goto error_free;
}
fscanf(sysfsfp, "%d", &test);
sprintf(temp, "%s/%s", basedir, filename);
sysfsfp = fopen(temp, "w");
if (sysfsfp == NULL) {
- printf("Could not open %s\n", temp);
ret = -errno;
+ printf("Could not open %s\n", temp);
goto error_free;
}
fprintf(sysfsfp, "%s", val);
if (verify) {
sysfsfp = fopen(temp, "r");
if (sysfsfp == NULL) {
- printf("could not open file to verify\n");
ret = -errno;
+ printf("could not open file to verify\n");
goto error_free;
}
fscanf(sysfsfp, "%s", temp);