summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2017-04-26 10:59:43 +0300
committerJohan Hedberg <johan.hedberg@intel.com>2017-04-28 16:06:25 +0300
commita409157b6b97f56965f0e006d78d309cbc9604c3 (patch)
treebfc6fd5b8aae05210f6dcadb7177f6e2bfbb35d9
parent5f5717b9af6acaed53170dd5d8e7e4b6e22cb709 (diff)
Bluetooth: L2CAP: Fix unnecessary NULL check
The segment allocation function can't fail (it eventually waits with K_FOREVER for a buffer to become available), so there's no point in checking its return value for NULL. Also, the connection state check is because of this particular waiting and not the semaphore waiting (which is done with K_NO_WAIT). Change-Id: I9698760541de810869cffc1c60cf97c5f8f7df8d Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
-rw-r--r--subsys/bluetooth/host/l2cap.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/subsys/bluetooth/host/l2cap.c b/subsys/bluetooth/host/l2cap.c
index 2d7a33be1..06c9121ff 100644
--- a/subsys/bluetooth/host/l2cap.c
+++ b/subsys/bluetooth/host/l2cap.c
@@ -1080,11 +1080,8 @@ static int l2cap_chan_le_send(struct bt_l2cap_le_chan *ch, struct net_buf *buf,
}
buf = l2cap_chan_create_seg(ch, buf, sdu_hdr_len);
- if (!buf) {
- return -ENOMEM;
- }
- /* Channel may have been disconnected while waiting for credits */
+ /* Channel may have been disconnected while waiting for a buffer */
if (!ch->chan.conn) {
net_buf_unref(buf);
return -ECONNRESET;