[PATCH BlueZ v3 4/5] shared/gatt-client: Fix gatt_client_init

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

 



From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>

This function is only called within bt_gatt_client_new therefore it is
not possible to have a ready callback and should return false if
bt_gatt_exchange_mtu fails.
---
 src/shared/gatt-client.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c
index ddedaf0..5833e7a 100644
--- a/src/shared/gatt-client.c
+++ b/src/shared/gatt-client.c
@@ -1005,10 +1005,8 @@ static bool gatt_client_init(struct bt_gatt_client *client, uint16_t mtu)
 							exchange_mtu_cb,
 							discovery_op_ref(op),
 							discovery_op_unref)) {
-		if (client->ready_callback)
-			client->ready_callback(false, 0, client->ready_data);
-
 		free(op);
+		return false;
 	}
 
 	client->in_init = true;
@@ -1269,7 +1267,8 @@ struct bt_gatt_client *bt_gatt_client_new(struct bt_att *att, uint16_t mtu)
 
 	client->att = bt_att_ref(att);
 
-	gatt_client_init(client, mtu);
+	if (!gatt_client_init(client, mtu))
+		goto fail;
 
 	return bt_gatt_client_ref(client);
 
-- 
1.9.3

--
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