From: Michael Buesch Date: Tue, 25 Mar 2008 17:04:46 +0000 (+0100) Subject: b44: Truncate PHY address X-Git-Tag: v2.6.25-rc8~77^2~10 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ea79631c0c47d28831a0635e8af9da539d449cd;p=linux-2.6 b44: Truncate PHY address Some ROMs on embedded devices store incorrect values for the PHY address of the ethernet device. It looks like the number is sign-extended. Truncate the value by applying the PHY-address mask to it. The patch was tested on a bcm47xx embedded system (where the bug triggers) and a bcm4400 PCI card. Signed-off-by: Michael Buesch Signed-off-by: Jeff Garzik --- diff --git a/drivers/net/b44.c b/drivers/net/b44.c index ea2a2b548e..25f1337cd0 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c @@ -2082,6 +2082,11 @@ static int __devinit b44_get_invariants(struct b44 *bp) addr = sdev->bus->sprom.et0mac; bp->phy_addr = sdev->bus->sprom.et0phyaddr; } + /* Some ROMs have buggy PHY addresses with the high + * bits set (sign extension?). Truncate them to a + * valid PHY address. */ + bp->phy_addr &= 0x1F; + memcpy(bp->dev->dev_addr, addr, 6); if (!is_valid_ether_addr(&bp->dev->dev_addr[0])){