From fb1f09d9e4ddc2992a357af56c861e77c1384e3c Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Thu, 2 Mar 2017 16:59:27 +0100 Subject: [PATCH] core: fix checking for busy lines If we have a bulk object containing only a single line passed to verify_line_bulk(), we end up not checking if the line was previously requested. Fix it by starting the iteration at offset 0 instead of 1 and skipping the line owner check for i == 0. Signed-off-by: Bartosz Golaszewski --- src/lib/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/core.c b/src/lib/core.c index 4d5be57..cefa985 100644 --- a/src/lib/core.c +++ b/src/lib/core.c @@ -533,10 +533,10 @@ static bool verify_line_bulk(struct gpiod_line_bulk *bulk) chip = gpiod_line_get_chip(bulk->lines[0]); - for (i = 1; i < bulk->num_lines; i++) { + for (i = 0; i < bulk->num_lines; i++) { line = bulk->lines[i]; - if (chip != gpiod_line_get_chip(line)) { + if (i > 0 && chip != gpiod_line_get_chip(line)) { set_last_error(GPIOD_EBULKINCOH); return false; } -- 2.30.2