return true;
}
-struct bt_hci *bt_hci_new(int fd)
+static struct bt_hci *create_hci(int fd)
{
struct bt_hci *hci;
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;
if (fd < 0)
return NULL;
- hci = bt_hci_new(fd);
+ hci = create_hci(fd);
if (!hci) {
close(fd);
return NULL;
return NULL;
}
- hci = bt_hci_new(fd);
+ hci = create_hci(fd);
if (!hci) {
close(fd);
return NULL;