Make verify_line_bulk() set the last error number (according to the
error condition) and verify if any line is busy too.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
chip = gpiod_line_get_chip(line_bulk->lines[0]);
for (i = 1; i < line_bulk->num_lines; i++) {
- if (chip != gpiod_line_get_chip(line_bulk->lines[i]))
+ if (chip != gpiod_line_get_chip(line_bulk->lines[i])) {
+ set_last_error(GPIOD_EBULKINCOH);
return false;
+ }
+
+ if (!gpiod_line_is_free(line_bulk->lines[i])) {
+ set_last_error(GPIOD_ELINEBUSY);
+ return false;
+ }
}
return true;
int status, fd;
unsigned int i;
- if (!verify_line_bulk(line_bulk)) {
- set_last_error(GPIOD_EBULKINCOH);
+ if (!verify_line_bulk(line_bulk))
return -1;
- }
req = zalloc(sizeof(*req));
if (!req)