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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f233c8a007d75a8adcc99a07c582b75bdc1985db.1657134099.git.philipp.g.hortmann@gmail.com>
Date:   Wed, 6 Jul 2022 21:19:06 +0200
From:   Philipp Hortmann <philipp.g.hortmann@...il.com>
To:     Forest Bond <forest@...ttletooquiet.net>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Joe Perches <joe@...ches.com>, linux-staging@...ts.linux.dev,
        linux-kernel@...r.kernel.org
Subject: [PATCH 2/2] staging: vt6655: Use loop in vt6655_mac_read_ether_addr

Use loop in vt6655_mac_read_ether_addr to avoid multiple
similar statements.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@...il.com>
---
Code for testing:
	for (int i = 0; i < 6; i++){
		mac_addr[i] = ioread8(iobase + MAC_REG_PAR0 + i);
		printk("i = %i\n", i);
	}
Log:
[ 3608.011168] i = 0
[ 3608.011170] i = 1
[ 3608.011172] i = 2
[ 3608.011174] i = 3
[ 3608.011176] i = 4
[ 3608.011178] i = 5
---
 drivers/staging/vt6655/device_main.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c
index 099f0b95417a..19840dddb4bf 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -200,12 +200,8 @@ static void vt6655_mac_write_bssid_addr(void __iomem *iobase, const u8 *mac_addr
 static void vt6655_mac_read_ether_addr(void __iomem *iobase, u8 *mac_addr)
 {
 	iowrite8(1, iobase + MAC_REG_PAGE1SEL);
-	mac_addr[0] = ioread8(iobase + MAC_REG_PAR0);
-	mac_addr[1] = ioread8(iobase + MAC_REG_PAR0 + 1);
-	mac_addr[2] = ioread8(iobase + MAC_REG_PAR0 + 2);
-	mac_addr[3] = ioread8(iobase + MAC_REG_PAR0 + 3);
-	mac_addr[4] = ioread8(iobase + MAC_REG_PAR0 + 4);
-	mac_addr[5] = ioread8(iobase + MAC_REG_PAR0 + 5);
+	for (int i = 0; i < 6; i++)
+		mac_addr[i] = ioread8(iobase + MAC_REG_PAR0 + i);
 	iowrite8(0, iobase + MAC_REG_PAGE1SEL);
 }
 
-- 
2.37.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ