Module Name: src Committed By: maxv Date: Wed Jul 3 17:40:30 UTC 2019
Modified Files: src/sys/dev/mii: makphy.c Log Message: Check the return value of PHY_READ(). Because, if it fails, 'reg' is not initialized. On Qemu, this read systematically fails. Print an error in this case, and act as if there was no fiber. Maybe there is a smarter way to fix this kind of things. To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/sys/dev/mii/makphy.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/mii/makphy.c diff -u src/sys/dev/mii/makphy.c:1.59 src/sys/dev/mii/makphy.c:1.60 --- src/sys/dev/mii/makphy.c:1.59 Mon Mar 25 07:34:13 2019 +++ src/sys/dev/mii/makphy.c Wed Jul 3 17:40:29 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: makphy.c,v 1.59 2019/03/25 07:34:13 msaitoh Exp $ */ +/* $NetBSD: makphy.c,v 1.60 2019/07/03 17:40:29 maxv Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -59,7 +59,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.59 2019/03/25 07:34:13 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.60 2019/07/03 17:40:29 maxv Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -204,7 +204,11 @@ page0: switch (model) { case MII_MODEL_xxMARVELL_E1011: case MII_MODEL_xxMARVELL_E1112: - PHY_READ(sc, MAKPHY_ESSR, ®); + if (PHY_READ(sc, MAKPHY_ESSR, ®) != 0) { + aprint_verbose_dev(self, + "Failed to read MAKPHY_ESSR\n"); + break; + } if (reg & ESSR_FIBER_LINK) sc->mii_flags |= MIIF_HAVEFIBER; break;