summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2017-08-11 13:51:46 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2017-08-11 13:51:46 +0000
commit765a3df7c01981e27b8c34a556cbc3b2cbc17ff8 (patch)
treedc1c1272cf0dffe1e01dce07e052553ec6db40cf /sys/net
parent983d899b230e96f6db3278040f2bcd04d7a930af (diff)
Instead of repeating the same return statement in both cases of a
final if statement, use it once after the if statement. Avoids duplicated and structurally dead code. Coverity CID 1452943; Severity: Insignificant OK millert@ goda@
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/switchofp.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/sys/net/switchofp.c b/sys/net/switchofp.c
index e38c9d2e70e..8cfe82f6f82 100644
--- a/sys/net/switchofp.c
+++ b/sys/net/switchofp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: switchofp.c,v 1.64 2017/08/11 13:50:15 reyk Exp $ */
+/* $OpenBSD: switchofp.c,v 1.65 2017/08/11 13:51:45 reyk Exp $ */
/*
* Copyright (c) 2016 Kazuya GODA <goda@openbsd.org>
@@ -1692,11 +1692,9 @@ swofp_ox_cmp_data(struct ofp_ox_match *target,
if (strict) {
if (tmask != kmask)
return (1);
- return !((tmth & tmask) == (kmth & kmask));
} else {
if ((tmask & kmask) != kmask)
return (1);
- return !((tmth & kmask) == (kmth & kmask));
}
return !((tmth & tmask) == (kmth & kmask));
@@ -1752,7 +1750,6 @@ swofp_ox_cmp_ipv6_addr(struct ofp_ox_match *target,
kmth.s6_addr32[2] &= kmask.s6_addr32[2];
kmth.s6_addr32[3] &= kmask.s6_addr32[3];
- return memcmp(&tmth, &kmth, sizeof(tmth));
} else {
tmask.s6_addr32[0] &= kmask.s6_addr32[0];
tmask.s6_addr32[1] &= kmask.s6_addr32[1];
@@ -1772,8 +1769,9 @@ swofp_ox_cmp_ipv6_addr(struct ofp_ox_match *target,
kmth.s6_addr32[2] &= kmask.s6_addr32[2];
kmth.s6_addr32[3] &= kmask.s6_addr32[3];
- return memcmp(&tmth, &kmth, sizeof(tmth));
}
+
+ return memcmp(&tmth, &kmth, sizeof(tmth));
}
#endif /* INET6 */
@@ -1815,12 +1813,12 @@ swofp_ox_cmp_ipv4_addr(struct ofp_ox_match *target,
if (strict) {
if (tmask != kmask)
return (1);
- return !((tmth & tmask) == (kmth & kmask));
} else {
if ((tmask & kmask) != kmask)
return (1);
- return !((tmth & kmask) == (kmth & kmask));
}
+
+ return !((tmth & kmask) == (kmth & kmask));
}
int
@@ -1855,12 +1853,12 @@ swofp_ox_cmp_vlan_vid(struct ofp_ox_match *target,
if (strict) {
if (tmask != kmask)
return (1);
- return !((tmth & tmask) == (kmth & kmask));
} else {
if ((tmask & kmask) != kmask)
return (1);
- return !((tmth & kmask) == (kmth & kmask));
}
+
+ return !((tmth & kmask) == (kmth & kmask));
}
int
@@ -1908,12 +1906,12 @@ swofp_ox_cmp_ether_addr(struct ofp_ox_match *target,
if (strict) {
if (tmask != kmask)
return (1);
- return !((tmth & tmask) == (kmth & kmask));
} else {
if ((tmask & kmask) != kmask)
return (1);
- return !((tmth & kmask) == (kmth & kmask));
}
+
+ return !((tmth & kmask) == (kmth & kmask));
}
int