]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - net/netrom/af_netrom.c
Merge branch 'perfcounters-fixes-for-linus' of git://git.kernel.org/pub/scm/linux...
[karo-tx-linux.git] / net / netrom / af_netrom.c
index 4e705f87969f332c30939dc8acabd4f8d4d74352..ce51ce012cdab48e4c0bbfd99c3053a0bfcaa636 100644 (file)
@@ -286,8 +286,7 @@ void nr_destroy_socket(struct sock *sk)
                kfree_skb(skb);
        }
 
-       if (atomic_read(&sk->sk_wmem_alloc) ||
-           atomic_read(&sk->sk_rmem_alloc)) {
+       if (sk_has_allocations(sk)) {
                /* Defer: outstanding buffers */
                sk->sk_timer.function = nr_destroy_timer;
                sk->sk_timer.expires  = jiffies + 2 * HZ;
@@ -1084,8 +1083,10 @@ static int nr_sendmsg(struct kiocb *iocb, struct socket *sock,
 
        /* Build a packet - the conventional user limit is 236 bytes. We can
           do ludicrously large NetROM frames but must not overflow */
-       if (len > 65536)
-               return -EMSGSIZE;
+       if (len > 65536) {
+               err = -EMSGSIZE;
+               goto out;
+       }
 
        SOCK_DEBUG(sk, "NET/ROM: sendto: building packet.\n");
        size = len + NR_NETWORK_LEN + NR_TRANSPORT_LEN;
@@ -1204,7 +1205,7 @@ static int nr_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
                long amount;
 
                lock_sock(sk);
-               amount = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc);
+               amount = sk->sk_sndbuf - sk_wmem_alloc_get(sk);
                if (amount < 0)
                        amount = 0;
                release_sock(sk);
@@ -1340,8 +1341,8 @@ static int nr_info_show(struct seq_file *seq, void *v)
                        nr->n2count,
                        nr->n2,
                        nr->window,
-                       atomic_read(&s->sk_wmem_alloc),
-                       atomic_read(&s->sk_rmem_alloc),
+                       sk_wmem_alloc_get(s),
+                       sk_rmem_alloc_get(s),
                        s->sk_socket ? SOCK_INODE(s->sk_socket)->i_ino : 0L);
 
                bh_unlock_sock(s);