From ebd96f892e2af2666f280b091cd31d4fd79a2dd1 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Thu, 27 Sep 2018 15:14:05 +0200
Subject: [PATCH] lib: Make fpi_timeout_add() never fail

It will now assert if the monotonic clock isn't available. If that's the
case, we'll have bigger problems anyway.
---
 libfprint/fpi-poll.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libfprint/fpi-poll.c b/libfprint/fpi-poll.c
index 623b154..4edd481 100644
--- a/libfprint/fpi-poll.c
+++ b/libfprint/fpi-poll.c
@@ -146,7 +146,9 @@ fpi_timeout_set_name(fpi_timeout *timeout,
  *
  * Note that you should hold onto the return value of this function to cancel it
  * use fpi_timeout_cancel(), otherwise the callback could be called while the driver
- * is being torn down. %NULL is returned on failure.
+ * is being torn down.
+ *
+ * This function can be considered to never fail.
  *
  * Returns: an #fpi_timeout structure
  */
@@ -167,6 +169,7 @@ fpi_timeout *fpi_timeout_add(unsigned int    msec,
 	r = clock_gettime(CLOCK_MONOTONIC, &ts);
 	if (r < 0) {
 		fp_err("failed to read monotonic clock, errno=%d", errno);
+		BUG();
 		return NULL;
 	}