diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2013-04-30 01:21:41 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-30 03:28:43 +0200 |
commit | 70e3ba72ba9afd4ec28ab09f6a27aac00c30b358 (patch) | |
tree | 4141a47fc8157b0fc65f2756561ccda876a039dd /net | |
parent | net/core: rename random32() to prandom_u32() (diff) | |
download | linux-70e3ba72ba9afd4ec28ab09f6a27aac00c30b358.tar.xz linux-70e3ba72ba9afd4ec28ab09f6a27aac00c30b358.zip |
net/core: remove duplicate statements by do-while loop
Remove duplicate statements by using do-while loop instead of while loop.
- A;
- while (e) {
+ do {
A;
- }
+ } while (e);
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/pktgen.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 4582275a76fa..5c217427a669 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c @@ -2396,18 +2396,15 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev) __be32 s; if (pkt_dev->flags & F_IPDST_RND) { - t = prandom_u32() % (imx - imn) + imn; - s = htonl(t); - - while (ipv4_is_loopback(s) || - ipv4_is_multicast(s) || - ipv4_is_lbcast(s) || - ipv4_is_zeronet(s) || - ipv4_is_local_multicast(s)) { + do { t = prandom_u32() % (imx - imn) + imn; s = htonl(t); - } + } while (ipv4_is_loopback(s) || + ipv4_is_multicast(s) || + ipv4_is_lbcast(s) || + ipv4_is_zeronet(s) || + ipv4_is_local_multicast(s)); pkt_dev->cur_daddr = s; } else { t = ntohl(pkt_dev->cur_daddr); |