Diff between 1122fdefdb7df6e72426a1b628c932b54e6b31d8 and 3fbd0bda53e00fbdc2b4bf3d04b32f685b495736

Changed Files

File Additions Deletions Status
src/shared/hci.c +14 -3 modified

Full Patch

diff --git a/src/shared/hci.c b/src/shared/hci.c
index cf677c0..6d0a5f8 100644
--- a/src/shared/hci.c
+++ b/src/shared/hci.c
@@ -285,7 +285,7 @@ static bool io_read_callback(struct io *io, void *user_data)
 	return true;
 }
 
-struct bt_hci *bt_hci_new(int fd)
+static struct bt_hci *create_hci(int fd)
 {
 	struct bt_hci *hci;
 
@@ -344,6 +344,17 @@ struct bt_hci *bt_hci_new(int fd)
 	return bt_hci_ref(hci);
 }
 
+struct bt_hci *bt_hci_new(int fd)
+{
+	struct bt_hci *hci;
+
+	hci = create_hci(fd);
+	if (!hci)
+		return NULL;
+
+	return hci;
+}
+
 static int create_socket(uint16_t index, uint16_t channel)
 {
 	struct sockaddr_hci addr;
@@ -376,7 +387,7 @@ struct bt_hci *bt_hci_new_user_channel(uint16_t index)
 	if (fd < 0)
 		return NULL;
 
-	hci = bt_hci_new(fd);
+	hci = create_hci(fd);
 	if (!hci) {
 		close(fd);
 		return NULL;
@@ -409,7 +420,7 @@ struct bt_hci *bt_hci_new_raw_device(uint16_t index)
 		return NULL;
 	}
 
-	hci = bt_hci_new(fd);
+	hci = create_hci(fd);
 	if (!hci) {
 		close(fd);
 		return NULL;