Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/marvell Initialize mvsoctmr_freq earlier (in mv...



details:   https://anonhg.NetBSD.org/src/rev/b20a6d782dc6
branches:  trunk
changeset: 793810:b20a6d782dc6
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Feb 26 19:41:46 2014 +0000

description:
Initialize mvsoctmr_freq earlier (in mvsoctmr_attach) to avoid division
by zero in calculation of the watchdog parameters.

diffstat:

 sys/arch/arm/marvell/mvsoctmr.c |  20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diffs (48 lines):

diff -r ef6f6b36721a -r b20a6d782dc6 sys/arch/arm/marvell/mvsoctmr.c
--- a/sys/arch/arm/marvell/mvsoctmr.c   Wed Feb 26 17:35:21 2014 +0000
+++ b/sys/arch/arm/marvell/mvsoctmr.c   Wed Feb 26 19:41:46 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mvsoctmr.c,v 1.11 2014/02/17 05:25:32 kiyohara Exp $   */
+/*     $NetBSD: mvsoctmr.c,v 1.12 2014/02/26 19:41:46 martin Exp $     */
 /*
  * Copyright (c) 2007, 2008, 2010 KIYOHARA Takashi
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mvsoctmr.c,v 1.11 2014/02/17 05:25:32 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvsoctmr.c,v 1.12 2014/02/26 19:41:46 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mvsoc.h"
@@ -185,6 +185,14 @@
        db_trap_callback = mvsoctmr_wdog_ddb_trap;
 #endif
 
+       if (sc->sc_flags & TMR_FLAGS_25MHZ)
+               /* We set global timer and counter to 25 MHz mode */
+               mvsoctmr_freq = 25000000;
+       else if (sc->sc_flags & TMR_FLAGS_SYSCLK)
+               mvsoctmr_freq = mvSysclk;
+       else
+               mvsoctmr_freq = mvTclk;
+
        sc->sc_wdog.smw_name = device_xname(self);
        sc->sc_wdog.smw_cookie = sc;
        sc->sc_wdog.smw_setmode = mvsoctmr_wdog_setmode;
@@ -248,14 +256,6 @@
        if (sc == NULL)
                panic("cpu_initclocks: mvsoctmr not found");
 
-       if (sc->sc_flags & TMR_FLAGS_25MHZ)
-               /* We set global timer and counter to 25 MHz mode */
-               mvsoctmr_freq = 25000000;
-       else if (sc->sc_flags & TMR_FLAGS_SYSCLK)
-               mvsoctmr_freq = mvSysclk;
-       else
-               mvsoctmr_freq = mvTclk;
-
        mvsoctmr_timecounter.tc_priv = sc;
        mvsoctmr_timecounter.tc_frequency = mvsoctmr_freq;
 



Home | Main Index | Thread Index | Old Index