net/core: remove duplicate statements by do-while loop
authorAkinobu Mita <akinobu.mita@gmail.com>
Mon, 29 Apr 2013 23:21:41 +0000 (16:21 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 30 Apr 2013 01:28:43 +0000 (18:28 -0700)
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>
net/core/pktgen.c

index 4582275..5c21742 100644 (file)
@@ -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);