From a85817580192a85e942d651941a655017447c426 Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Mon, 2 Oct 2017 16:34:05 +0200 Subject: [PATCH] core: drop unnecessary checks The getter functions retrieving the file descriptors (both for events and line values) check the line state internally but we don't check their return values and just pass them on to ioctl()s. Drop the checks altogether. Signed-off-by: Bartosz Golaszewski --- src/lib/core.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/lib/core.c b/src/lib/core.c index 11d03f2..6ca9909 100644 --- a/src/lib/core.c +++ b/src/lib/core.c @@ -269,15 +269,12 @@ static void line_set_state(struct gpiod_line *line, int state) static int line_get_handle_fd(struct gpiod_line *line) { - int state = line_get_state(line); - - return state == LINE_REQUESTED_VALUES ? line->handle->request.fd : -1; + return line->handle->request.fd; } static int line_get_event_fd(struct gpiod_line *line) { - return line_get_state(line) == LINE_REQUESTED_EVENTS - ? line->event.fd : -1; + return line->event.fd; } static void line_set_handle(struct gpiod_line *line, -- 2.30.2