Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/samsung Avoid divide-by-zero for unconfigured PLLs



details:   https://anonhg.NetBSD.org/src/rev/8f9a5f93f45c
branches:  trunk
changeset: 824598:8f9a5f93f45c
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sun Jun 11 00:13:15 2017 +0000

description:
Avoid divide-by-zero for unconfigured PLLs

diffstat:

 sys/arch/arm/samsung/exynos_reg.h |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (19 lines):

diff -r 90bb6fae5df8 -r 8f9a5f93f45c sys/arch/arm/samsung/exynos_reg.h
--- a/sys/arch/arm/samsung/exynos_reg.h Sun Jun 11 00:03:29 2017 +0000
+++ b/sys/arch/arm/samsung/exynos_reg.h Sun Jun 11 00:13:15 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: exynos_reg.h,v 1.14 2017/06/10 15:13:18 jmcneill Exp $ */
+/*     $NetBSD: exynos_reg.h,v 1.15 2017/06/11 00:13:15 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -124,7 +124,8 @@
 #define PLL_CON0_P                     __BITS( 8,13)   /* PLL P divide value */
 #define PLL_CON0_S                     __BITS( 0, 2)   /* PLL S divide value */
 
-#define PLL_PMS2FREQ(F, M, P, S) (((M)*(F))/((P)*(1<<(S))))
+#define PLL_PMS2FREQ(F, M, P, S) \
+       ((P) == 0 ? 0 : (((M)*(F))/((P)*(1<<(S)))))
 #define PLL_FREQ(f, v) PLL_PMS2FREQ( \
        (f),\
        __SHIFTOUT((v), PLL_CON0_M),\



Home | Main Index | Thread Index | Old Index