Skip to contentSkip to conversation

atm: slight optimization of addr compare

PATCH Superseded Ding Tianhong 1 participant 1 message Dec 23, 2013

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 5/21 atm: slight optimization of addr compare

Use the recently added and possibly more efficient ether_addr_equal_unaligned to instead of memcmp.

---
 drivers/atm/nicstar.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/atm/nicstar.c +1 -2
index 5aca5f4..d636f7f 100644
@@ -781,8 +781,7 @@ static int ns_init_card(int i, struct pci_dev *pcidev)
 	if (mac[i] == NULL || !mac_pton(mac[i], card->atmdev->esi)) {
 		nicstar_read_eprom(card->membase, NICSTAR_EPROM_MAC_ADDR_OFFSET,
 				   card->atmdev->esi, 6);
-		if (memcmp(card->atmdev->esi, "\x00\x00\x00\x00\x00\x00", 6) ==
-		    0) {
+		if (ether_addr_equal_unaligned(card->atmdev->esi, "\x00\x00\x00\x00\x00\x00")) {
 			nicstar_read_eprom(card->membase,
 					   NICSTAR_EPROM_MAC_ADDR_OFFSET_ALT,
 					   card->atmdev->esi, 6);
Signature · 1 line
1.8.0