linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jianlin Lv <Jianlin.Lv@arm.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, Song.Zhu@arm.com,
	Jianlin.Lv@arm.com, linux-kernel@vger.kernel.org
Subject: [PATCH net-next] net: Remove unnecessary intermediate variables
Date: Sat, 22 Aug 2020 10:04:31 +0800	[thread overview]
Message-ID: <20200822020431.125732-1-Jianlin.Lv@arm.com> (raw)

It is not necessary to use src/dst as an intermediate variable for
assignment operation; Delete src/dst intermediate variables to avoid
unnecessary variable declarations.

Signed-off-by: Jianlin Lv <Jianlin.Lv@arm.com>
---
 drivers/net/vxlan.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index b9fefe27e3e8..c00ca01ebe76 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -2728,12 +2728,8 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
 			goto tx_error;
 		} else if (err) {
 			if (info) {
-				struct in_addr src, dst;
-
-				src = remote_ip.sin.sin_addr;
-				dst = local_ip.sin.sin_addr;
-				info->key.u.ipv4.src = src.s_addr;
-				info->key.u.ipv4.dst = dst.s_addr;
+				info->key.u.ipv4.src = remote_ip.sin.sin_addr.s_addr;
+				info->key.u.ipv4.dst = local_ip.sin.sin_addr.s_addr;
 			}
 			vxlan_encap_bypass(skb, vxlan, vxlan, vni, false);
 			dst_release(ndst);
@@ -2784,12 +2780,8 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
 			goto tx_error;
 		} else if (err) {
 			if (info) {
-				struct in6_addr src, dst;
-
-				src = remote_ip.sin6.sin6_addr;
-				dst = local_ip.sin6.sin6_addr;
-				info->key.u.ipv6.src = src;
-				info->key.u.ipv6.dst = dst;
+				info->key.u.ipv6.src = remote_ip.sin6.sin6_addr;
+				info->key.u.ipv6.dst = local_ip.sin6.sin6_addr;
 			}
 
 			vxlan_encap_bypass(skb, vxlan, vxlan, vni, false);
-- 
2.17.1


             reply	other threads:[~2020-08-22  2:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-22  2:04 Jianlin Lv [this message]
2020-08-22 19:33 ` [PATCH net-next] net: Remove unnecessary intermediate variables David Miller
2020-08-22 20:39   ` Joe Perches
2020-08-22 20:59     ` David Miller
2020-08-22 21:03       ` Joe Perches
2020-08-22 21:07         ` David Miller
2020-08-22 21:20           ` Joe Perches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200822020431.125732-1-Jianlin.Lv@arm.com \
    --to=jianlin.lv@arm.com \
    --cc=Song.Zhu@arm.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).