Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic if we read an insane mac address from the chip, d...



details:   https://anonhg.NetBSD.org/src/rev/c7c2f97e2127
branches:  trunk
changeset: 803263:c7c2f97e2127
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sun Oct 19 22:31:33 2014 +0000

description:
if we read an insane mac address from the chip, dont attach

diffstat:

 sys/dev/ic/dwc_gmac.c |  9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diffs (26 lines):

diff -r 2941139b77a1 -r c7c2f97e2127 sys/dev/ic/dwc_gmac.c
--- a/sys/dev/ic/dwc_gmac.c     Sun Oct 19 17:33:58 2014 +0000
+++ b/sys/dev/ic/dwc_gmac.c     Sun Oct 19 22:31:33 2014 +0000
@@ -39,7 +39,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.13 2014/10/19 13:15:23 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.14 2014/10/19 22:31:33 jmcneill Exp $");
 
 /* #define     DWC_GMAC_DEBUG  1 */
 
@@ -153,6 +153,13 @@
                    AWIN_GMAC_MAC_ADDR0LO);
                machi = bus_space_read_4(sc->sc_bst, sc->sc_bsh,
                    AWIN_GMAC_MAC_ADDR0HI);
+
+               if (maclo == 0xffffffff && (machi & 0xffff) == 0xffff) {
+                       aprint_error_dev(sc->sc_dev,
+                           "couldn't read MAC address\n");
+                       return;
+               }
+
                enaddr[0] = maclo & 0x0ff;
                enaddr[1] = (maclo >> 8) & 0x0ff;
                enaddr[2] = (maclo >> 16) & 0x0ff;



Home | Main Index | Thread Index | Old Index