[PATCH 5/5] android: Stop mainloop if reading index list failed

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

 



If reading index list failed mainloop should be stopped since adapter
init guard timer is not yet running.
---
 android/main.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/android/main.c b/android/main.c
index 4bb5101..72e47f2 100644
--- a/android/main.c
+++ b/android/main.c
@@ -528,12 +528,12 @@ static void read_index_list_complete(uint8_t status, uint16_t length,
 	if (status) {
 		error("%s: Failed to read index list: %s (0x%02x)",
 					__func__, mgmt_errstr(status), status);
-		return;
+		goto error;
 	}
 
 	if (length < sizeof(*rp)) {
 		error("%s: Wrong size of read index list response", __func__);
-		return;
+		goto error;
 	}
 
 	num = btohs(rp->num_controllers);
@@ -542,7 +542,7 @@ static void read_index_list_complete(uint8_t status, uint16_t length,
 
 	if (num * sizeof(uint16_t) + sizeof(*rp) != length) {
 		error("%s: Incorrect pkt size for index list rsp", __func__);
-		return;
+		goto error;
 	}
 
 	if (adapter_index != MGMT_INDEX_NONE)
@@ -553,13 +553,17 @@ static void read_index_list_complete(uint8_t status, uint16_t length,
 						adapter_timeout_handler, NULL);
 		if (adapter_timeout == 0) {
 			error("%s: Failed init timeout", __func__);
-			g_main_loop_quit(event_loop);
+			goto error;
 		}
 		return;
 	}
 
 	adapter_index = btohs(rp->index[0]);
 	bt_adapter_init(adapter_index, mgmt_if, adapter_ready);
+	return;
+
+error:
+	g_main_loop_quit(event_loop);
 }
 
 static void read_commands_complete(uint8_t status, uint16_t length,
-- 
1.8.4.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