]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
virtio_net: Simplify call sites for virtio_net_hdr_{from, to}_skb().
authorJarno Rajahalme <jarno@ovn.org>
Fri, 18 Nov 2016 23:40:38 +0000 (15:40 -0800)
committerDavid S. Miller <davem@davemloft.net>
Sat, 19 Nov 2016 15:37:03 +0000 (10:37 -0500)
No point storing the return value of virtio_net_hdr_to_skb() or
virtio_net_hdr_from_skb() to a variable when the value is used only
once as a boolean in an immediately following if statement.

Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/macvtap.c
drivers/net/tun.c

index 070e3290aa6efea6fcb505cdf0860a4dce676b74..5da9861ad79cd0857511d7927f6408740cbd56bd 100644 (file)
@@ -821,9 +821,8 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q,
                if (iov_iter_count(iter) < vnet_hdr_len)
                        return -EINVAL;
 
-               ret = virtio_net_hdr_from_skb(skb, &vnet_hdr,
-                                             macvtap_is_little_endian(q));
-               if (ret)
+               if (virtio_net_hdr_from_skb(skb, &vnet_hdr,
+                                           macvtap_is_little_endian(q)))
                        BUG();
 
                if (copy_to_iter(&vnet_hdr, sizeof(vnet_hdr), iter) !=
index 1588469844e77af30596c4498eb0bde9257e0293..3b8d8cc6d2ea0fbab92e2084503ac0bc81b95029 100644 (file)
@@ -1252,8 +1252,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
                return -EFAULT;
        }
 
-       err = virtio_net_hdr_to_skb(skb, &gso, tun_is_little_endian(tun));
-       if (err) {
+       if (virtio_net_hdr_to_skb(skb, &gso, tun_is_little_endian(tun))) {
                this_cpu_inc(tun->pcpu_stats->rx_frame_errors);
                kfree_skb(skb);
                return -EINVAL;
@@ -1367,9 +1366,8 @@ static ssize_t tun_put_user(struct tun_struct *tun,
                if (iov_iter_count(iter) < vnet_hdr_sz)
                        return -EINVAL;
 
-               ret = virtio_net_hdr_from_skb(skb, &gso,
-                                             tun_is_little_endian(tun));
-               if (ret) {
+               if (virtio_net_hdr_from_skb(skb, &gso,
+                                           tun_is_little_endian(tun))) {
                        struct skb_shared_info *sinfo = skb_shinfo(skb);
                        pr_err("unexpected GSO type: "
                               "0x%x, gso_size %d, hdr_len %d\n",