]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Bluetooth: Remove unnecessary L2CAP channel state check
authorJohan Hedberg <johan.hedberg@intel.com>
Mon, 29 Apr 2013 16:35:42 +0000 (19:35 +0300)
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>
Wed, 29 May 2013 21:43:37 +0000 (18:43 -0300)
In l2cap_att_channel() we're only interested in the BT_CONNECTED state
so this state can directly be passed to l2cap_global_chan_by_scid().
This way there's no need to do any additional state check later.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
net/bluetooth/l2cap_core.c

index 6de8316c4bdf99bf94acedaf7c5a906b241226eb..c9d9679dd46e68131e96928464113a56a9bcc5be 100644 (file)
@@ -6357,16 +6357,13 @@ static void l2cap_att_channel(struct l2cap_conn *conn,
 {
        struct l2cap_chan *chan;
 
-       chan = l2cap_global_chan_by_scid(0, L2CAP_CID_ATT,
+       chan = l2cap_global_chan_by_scid(BT_CONNECTED, L2CAP_CID_ATT,
                                         conn->src, conn->dst);
        if (!chan)
                goto drop;
 
        BT_DBG("chan %p, len %d", chan, skb->len);
 
-       if (chan->state != BT_BOUND && chan->state != BT_CONNECTED)
-               goto drop;
-
        if (chan->imtu < skb->len)
                goto drop;