Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/mvme68k/mvme68k PR 50792 David Binderman: make sure...



details:   https://anonhg.NetBSD.org/src/rev/655d7c8ed236
branches:  trunk
changeset: 815653:655d7c8ed236
user:      dholland <dholland%NetBSD.org@localhost>
date:      Tue May 31 03:25:46 2016 +0000

description:
PR 50792 David Binderman: make sure we don't divide by zero.

The loop that picks delay_divisor might conceivably reject all values,
particularly if the hardware is sulking for some reason; in that case
it'll be left zero. Use 1 instead of 0 so we don't then crash.

diffstat:

 sys/arch/mvme68k/mvme68k/machdep.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r 2afdf2d95149 -r 655d7c8ed236 sys/arch/mvme68k/mvme68k/machdep.c
--- a/sys/arch/mvme68k/mvme68k/machdep.c        Tue May 31 03:22:30 2016 +0000
+++ b/sys/arch/mvme68k/mvme68k/machdep.c        Tue May 31 03:25:46 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.153 2014/03/24 19:52:27 christos Exp $   */
+/*     $NetBSD: machdep.c,v 1.154 2016/05/31 03:25:46 dholland Exp $   */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.153 2014/03/24 19:52:27 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.154 2016/05/31 03:25:46 dholland Exp $");
 
 #include "opt_ddb.h"
 #include "opt_m060sp.h"
@@ -309,6 +309,10 @@
                bus_space_write_1(bt, bh, PCCREG_TMR1_CONTROL, PCC_TIMERCLEAR);
                /* retry! */
        }
+       /* just in case */
+       if (delay_divisor == 0) {
+               delay_divisor = 1;
+       }
 
        bus_space_unmap(bt, bh, PCCREG_SIZE);
 



Home | Main Index | Thread Index | Old Index