From c22f55194002d796ed590d2109810d36f4ab8a7b Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Wed, 17 Feb 2016 16:37:26 +0200 Subject: [PATCH] Bluetooth: L2CAP: Log an error if data cannot be sent This add an error to the output which helps detects failures in case debug is not enabled. Change-Id: I2f4ed357ccf288c15b231d637bf1986af9ecbf37 Signed-off-by: Luiz Augusto von Dentz --- net/bluetooth/l2cap.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index dcb6016ae2e..a6090ba3826 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c @@ -1277,6 +1277,8 @@ static int l2cap_chan_le_send_sdu(struct bt_l2cap_chan *chan, int bt_l2cap_chan_send(struct bt_l2cap_chan *chan, struct net_buf *buf) { + int err; + BT_DBG("chan %p buf %p len %u", chan, buf, buf->len); if (!buf) { @@ -1288,6 +1290,11 @@ int bt_l2cap_chan_send(struct bt_l2cap_chan *chan, struct net_buf *buf) } /* TODO: Check conn/address type when BR/EDR is introduced */ - return l2cap_chan_le_send_sdu(chan, buf); + err = l2cap_chan_le_send_sdu(chan, buf); + if (err < 0) { + BT_ERR("failed to send message %d", err); + } + + return err; } #endif /* CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL */