summaryrefslogtreecommitdiffstats
path: root/drivers/net/tun.c
diff options
context:
space:
mode:
authorJarno Rajahalme <jarno@ovn.org>2016-11-19 00:40:38 +0100
committerDavid S. Miller <davem@davemloft.net>2016-11-19 16:37:03 +0100
commit3e9e40e74753346218e8285cf1ecff9ef3a624c6 (patch)
treeefc76c91903ebe831f20503ede23baebfc447222 /drivers/net/tun.c
parentcxgb4: Allocate Tx queues dynamically (diff)
downloadlinux-3e9e40e74753346218e8285cf1ecff9ef3a624c6.tar.xz
linux-3e9e40e74753346218e8285cf1ecff9ef3a624c6.zip
virtio_net: Simplify call sites for virtio_net_hdr_{from, to}_skb().
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>
Diffstat (limited to '')
-rw-r--r--drivers/net/tun.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 1588469844e7..3b8d8cc6d2ea 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -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",