From: Bartosz Golaszewski Date: Mon, 2 Oct 2017 14:34:05 +0000 (+0200) Subject: core: drop unnecessary checks X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=a85817580192a85e942d651941a655017447c426;p=qemu-gpiodev%2Flibgpiod.git 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 --- 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,