lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAE28pkNNsUnp4UiaKX-OjAQHPGjSNY6+hn-oK39m8w=ybXSO6Q@mail.gmail.com>
Date:   Mon, 27 Dec 2021 16:19:10 +0300
From:   Adam Kandur <sys.arch.adam@...il.com>
To:     netdev@...r.kernel.org, linux-staging@...ts.linux.dev
Subject: [PATCH] qlge: rewrite qlge_change_rx_buffers()

I replaced while loop with for. It looks nicer to me.

Signed-off-by: Adam Kandur <sys.arch.adam@...il.com>

---
 drivers/staging/qlge/qlge_main.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c
index 9873bb2a9ee4..69d57c2e199a 100644
--- a/drivers/staging/qlge/qlge_main.c
+++ b/drivers/staging/qlge/qlge_main.c
@@ -4012,19 +4012,17 @@ static int qlge_change_rx_buffers(struct
qlge_adapter *qdev)

        /* Wait for an outstanding reset to complete. */
        if (!test_bit(QL_ADAPTER_UP, &qdev->flags)) {
-               int i = 4;
+               for (int i = 4; !test_bit(QL_ADAPTER_UP, &qdev->flags); i--) {
+                       if (!i) {
+                               netif_err(qdev, ifup, qdev->ndev,
+                                         "Timed out waiting for adapter UP\n");
+                               return -ETIMEDOUT;
+                       }

-               while (--i && !test_bit(QL_ADAPTER_UP, &qdev->flags)) {
                        netif_err(qdev, ifup, qdev->ndev,
                                  "Waiting for adapter UP...\n");
                        ssleep(1);
                }
-
-               if (!i) {
-                       netif_err(qdev, ifup, qdev->ndev,
-                                 "Timed out waiting for adapter UP\n");
-                       return -ETIMEDOUT;
-               }
        }

        status = qlge_adapter_down(qdev);
-- 
2.34.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ