Diff between ee86b4a2550fd171e2087247d109c2aa91038a8f and fddcaa48337bb3bcef542f700a34d5b3d56e9776

Changed Files

File Additions Deletions Status
android/mcap-lib.c +7 -2 modified

Full Patch

diff --git a/android/mcap-lib.c b/android/mcap-lib.c
index 21db5b4..8e65bbd 100644
--- a/android/mcap-lib.c
+++ b/android/mcap-lib.c
@@ -2648,12 +2648,14 @@ static gboolean get_all_clocks(struct mcap_mcl *mcl, uint32_t *btclock,
 
 	while (latency > caps(mcl)->preempt_thresh && --retry >= 0) {
 
-		clock_gettime(CLK, &t0);
+		if (clock_gettime(CLK, &t0) < 0)
+			return FALSE;
 
 		if (!read_btclock(mcl, btclock, &btres))
 			continue;
 
-		clock_gettime(CLK, base_time);
+		if (clock_gettime(CLK, base_time) < 0)
+			return FALSE;
 
 		/*
 		 * Tries to detect preemption between clock_gettime
@@ -2662,6 +2664,9 @@ static gboolean get_all_clocks(struct mcap_mcl *mcl, uint32_t *btclock,
 		latency = time_us(base_time) - time_us(&t0);
 	}
 
+	if (retry < 0)
+		return FALSE;
+
 	*timestamp = mcap_get_timestamp(mcl, base_time);
 
 	return TRUE;