Bluetooth: L2CAP: Remove bogus NULL checks

The ch pointer is the result of a CONTAINER_OF() operation, so
checking it for NULL is pointless. Additionally, there's no place that
calls this function with chan set to NULL.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2019-12-18 23:57:42 +02:00 committed by Johan Hedberg
commit 525889c6b5

View file

@ -110,12 +110,12 @@ static struct bt_l2cap_le_chan *l2cap_chan_alloc_cid(struct bt_conn *conn,
* No action needed if there's already a CID allocated, e.g. in
* the case of a fixed channel.
*/
if (ch && ch->rx.cid > 0) {
if (ch->rx.cid > 0) {
return ch;
}
for (cid = L2CAP_LE_CID_DYN_START; cid <= L2CAP_LE_CID_DYN_END; cid++) {
if (ch && !bt_l2cap_le_lookup_rx_cid(conn, cid)) {
if (!bt_l2cap_le_lookup_rx_cid(conn, cid)) {
ch->rx.cid = cid;
return ch;
}