[PATCHv2 10/11] android/health: Fix missing error check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Andrei Emeltchenko <andrei.emeltchenko@xxxxxxxxx>

---
 android/mcap-lib.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/android/mcap-lib.c b/android/mcap-lib.c
index 346688e..2a86416 100644
--- a/android/mcap-lib.c
+++ b/android/mcap-lib.c
@@ -2654,12 +2654,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
@@ -2668,6 +2670,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;
-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux