Bluetooth: Call ops->teardown() without checking for NULL
authorGustavo Padovan <gustavo.padovan@collabora.co.uk>
Sat, 6 Oct 2012 10:51:54 +0000 (11:51 +0100)
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>
Fri, 12 Oct 2012 10:30:20 +0000 (18:30 +0800)
Users that don't implement teardown() should use l2cap_chan_no_teardown()

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

index 7c453d6f7354b5ee4c177a150862f56ca121bd1f..2fb37dee7754f520aa5c1a060a3fa31412f68ad5 100644 (file)
@@ -542,8 +542,7 @@ void l2cap_chan_del(struct l2cap_chan *chan, int err)
                        hci_conn_put(conn->hcon);
        }
 
-       if (chan->ops->teardown)
-               chan->ops->teardown(chan, err);
+       chan->ops->teardown(chan, err);
 
        if (test_bit(CONF_NOT_COMPLETE, &chan->conf_state))
                return;
@@ -582,8 +581,7 @@ void l2cap_chan_close(struct l2cap_chan *chan, int reason)
 
        switch (chan->state) {
        case BT_LISTEN:
-               if (chan->ops->teardown)
-                       chan->ops->teardown(chan, 0);
+               chan->ops->teardown(chan, 0);
                break;
 
        case BT_CONNECTED:
@@ -625,8 +623,7 @@ void l2cap_chan_close(struct l2cap_chan *chan, int reason)
                break;
 
        default:
-               if (chan->ops->teardown)
-                       chan->ops->teardown(chan, 0);
+               chan->ops->teardown(chan, 0);
                break;
        }
 }