net/can: add module alias to can protocol drivers
[safe/jmp/linux-2.6] / net / irda / af_irda.c
index ae54b20..cb762c8 100644 (file)
@@ -913,9 +913,6 @@ static int irda_accept(struct socket *sock, struct socket *newsock, int flags)
        /* Clean up the original one to keep it in listen state */
        irttp_listen(self->tsap);
 
-       /* Wow ! What is that ? Jean II */
-       skb->sk = NULL;
-       skb->destructor = NULL;
        kfree_skb(skb);
        sk->sk_ack_backlog--;
 
@@ -1093,11 +1090,6 @@ static int irda_create(struct net *net, struct socket *sock, int protocol)
 
        init_waitqueue_head(&self->query_wait);
 
-       /* Initialise networking socket struct */
-       sock_init_data(sock, sk);       /* Note : set sk->sk_refcnt to 1 */
-       sk->sk_family = PF_IRDA;
-       sk->sk_protocol = protocol;
-
        switch (sock->type) {
        case SOCK_STREAM:
                sock->ops = &irda_stream_ops;
@@ -1124,13 +1116,20 @@ static int irda_create(struct net *net, struct socket *sock, int protocol)
                        self->max_sdu_size_rx = TTP_SAR_UNBOUND;
                        break;
                default:
+                       sk_free(sk);
                        return -ESOCKTNOSUPPORT;
                }
                break;
        default:
+               sk_free(sk);
                return -ESOCKTNOSUPPORT;
        }
 
+       /* Initialise networking socket struct */
+       sock_init_data(sock, sk);       /* Note : set sk->sk_refcnt to 1 */
+       sk->sk_family = PF_IRDA;
+       sk->sk_protocol = protocol;
+
        /* Register as a client with IrLMP */
        self->ckey = irlmp_register_client(0, NULL, NULL, NULL);
        self->mask.word = 0xffff;
@@ -1760,7 +1759,8 @@ static int irda_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
        switch (cmd) {
        case TIOCOUTQ: {
                long amount;
-               amount = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc);
+
+               amount = sk->sk_sndbuf - sk_wmem_alloc_get(sk);
                if (amount < 0)
                        amount = 0;
                if (put_user(amount, (unsigned int __user *)arg))