Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/allwinner Avoid a divide by 0 when unplugging a...



details:   https://anonhg.NetBSD.org/src/rev/6e4ec1de5786
branches:  trunk
changeset: 811196:6e4ec1de5786
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Fri Oct 16 14:22:25 2015 +0000

description:
Avoid a divide by 0 when unplugging a sd card.

diffstat:

 sys/arch/arm/allwinner/awin_mmc.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r 8469a6a1cfe5 -r 6e4ec1de5786 sys/arch/arm/allwinner/awin_mmc.c
--- a/sys/arch/arm/allwinner/awin_mmc.c Fri Oct 16 00:41:07 2015 +0000
+++ b/sys/arch/arm/allwinner/awin_mmc.c Fri Oct 16 14:22:25 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_mmc.c,v 1.21 2015/08/08 17:21:19 jmcneill Exp $ */
+/* $NetBSD: awin_mmc.c,v 1.22 2015/10/16 14:22:25 bouyer Exp $ */
 
 /*-
  * Copyright (c) 2014 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
 #include "locators.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: awin_mmc.c,v 1.21 2015/08/08 17:21:19 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awin_mmc.c,v 1.22 2015/10/16 14:22:25 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -346,7 +346,10 @@
                sdly = 0;
                clksrc = AWIN_SD_CLK_SRC_SEL_OSC24M;
                n = 2;
-               m = ((osc24m_freq / (1 << n)) / freq) - 1;
+               if (freq > 0)
+                       m = ((osc24m_freq / (1 << n)) / freq) - 1;
+               else
+                       m = 15;
        } else if (freq <= 25000) {
                odly = 0;
                sdly = 5;



Home | Main Index | Thread Index | Old Index