]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
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 4582275a76fab971db6ed07fc576915a47283e19..5c217427a669391d2ba372ad23e479d52bb331af 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);