Module Name: src Committed By: christos Date: Sun May 24 14:56:57 UTC 2015
Modified Files: src/sys/dev/pci: auich.c Log Message: PR/49927: Robert Millan: Avoid zerodivide on emulated hardware. To generate a diff of this commit: cvs rdiff -u -r1.146 -r1.147 src/sys/dev/pci/auich.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/pci/auich.c diff -u src/sys/dev/pci/auich.c:1.146 src/sys/dev/pci/auich.c:1.147 --- src/sys/dev/pci/auich.c:1.146 Sun May 24 10:55:12 2015 +++ src/sys/dev/pci/auich.c Sun May 24 10:56:57 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: auich.c,v 1.146 2015/05/24 14:55:12 christos Exp $ */ +/* $NetBSD: auich.c,v 1.147 2015/05/24 14:56:57 christos Exp $ */ /*- * Copyright (c) 2000, 2004, 2005, 2008 The NetBSD Foundation, Inc. @@ -111,7 +111,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: auich.c,v 1.146 2015/05/24 14:55:12 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: auich.c,v 1.147 2015/05/24 14:56:57 christos Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -1709,6 +1709,13 @@ auich_calibrate(struct auich_softc *sc) return; } + if (wait_us == 0) { + /* Can happen with emulated hardware */ + aprint_error_dev(sc->sc_dev, "abnormal zero delay during " + "calibration\n"); + return; + } + rnd_add_data(NULL, &wait_us, sizeof(wait_us), 1); actual_48k_rate = (bytes * UINT64_C(250000)) / wait_us;