From: "Gustavo A. R. Silva" <garsilva@embeddedor.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: linux-decnet-user@lists.sourceforge.net, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
"Gustavo A. R. Silva" <garsilva@embeddedor.com>
Subject: [PATCH] net: decnet: dn_nsp_out: use swap macro in dn_mk_ack_header
Date: Sat, 28 Oct 2017 15:39:48 -0500 [thread overview]
Message-ID: <20171028203948.GA6173@embeddedor.com> (raw)
Make use of the swap macro and remove unnecessary variable tmp.
This makes the code easier to read and maintain.
This code was detected with the help of Coccinelle.
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
net/decnet/dn_nsp_out.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/net/decnet/dn_nsp_out.c b/net/decnet/dn_nsp_out.c
index e50a4ad..56a52a0 100644
--- a/net/decnet/dn_nsp_out.c
+++ b/net/decnet/dn_nsp_out.c
@@ -313,11 +313,8 @@ static __le16 *dn_mk_ack_header(struct sock *sk, struct sk_buff *skb, unsigned c
ackcrs |= 0x8000;
/* If this is an "other data/ack" message, swap acknum and ackcrs */
- if (other) {
- unsigned short tmp = acknum;
- acknum = ackcrs;
- ackcrs = tmp;
- }
+ if (other)
+ swap(acknum, ackcrs);
/* Set "cross subchannel" bit in ackcrs */
ackcrs |= 0x2000;
--
2.7.4
next reply other threads:[~2017-10-28 20:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-28 20:39 Gustavo A. R. Silva [this message]
2017-11-01 3:06 ` [PATCH] net: decnet: dn_nsp_out: use swap macro in dn_mk_ack_header David Miller
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=20171028203948.GA6173@embeddedor.com \
--to=garsilva@embeddedor.com \
--cc=davem@davemloft.net \
--cc=linux-decnet-user@lists.sourceforge.net \
--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).