Bluetooth: Simplify pin_code_neg_reply function
There is no need for tracking if connection object exists. Change-Id: I14047631b4697f892139a414c248542a2b3ae3d6 Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This commit is contained in:
parent
a524f335fd
commit
d8355793d1
1 changed files with 1 additions and 14 deletions
|
@ -1569,32 +1569,19 @@ static void pin_code_req(struct net_buf *buf)
|
|||
static int pin_code_neg_reply(const bt_addr_t *bdaddr)
|
||||
{
|
||||
struct bt_hci_cp_pin_code_neg_reply *cp;
|
||||
struct bt_conn *conn;
|
||||
struct net_buf *buf;
|
||||
int err;
|
||||
|
||||
BT_DBG("");
|
||||
|
||||
conn = bt_conn_lookup_addr_br(bdaddr);
|
||||
if (!conn) {
|
||||
BT_ERR("Can't find conn for %s", bt_addr_str(bdaddr));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
buf = bt_hci_cmd_create(BT_HCI_OP_PIN_CODE_NEG_REPLY, sizeof(*cp));
|
||||
if (!buf) {
|
||||
bt_conn_unref(conn);
|
||||
return -ENOBUFS;
|
||||
}
|
||||
|
||||
cp = net_buf_add(buf, sizeof(*cp));
|
||||
bt_addr_copy(&cp->bdaddr, bdaddr);
|
||||
|
||||
err = bt_hci_cmd_send_sync(BT_HCI_OP_PIN_CODE_NEG_REPLY, buf, NULL);
|
||||
|
||||
bt_conn_unref(conn);
|
||||
|
||||
return err;
|
||||
return bt_hci_cmd_send_sync(BT_HCI_OP_PIN_CODE_NEG_REPLY, buf, NULL);
|
||||
}
|
||||
|
||||
static int pin_code_reply(const bt_addr_t *bdaddr, const char *pin)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue