Module Name:    src
Committed By:   aymeric
Date:           Sun Oct 14 18:53:01 UTC 2018

Modified Files:
        src/sys/arch/arm/altera: cycv_rstmgr.c

Log Message:
Fix off-by-one when computing reset register address


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/altera/cycv_rstmgr.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/arch/arm/altera/cycv_rstmgr.c
diff -u src/sys/arch/arm/altera/cycv_rstmgr.c:1.1 src/sys/arch/arm/altera/cycv_rstmgr.c:1.2
--- src/sys/arch/arm/altera/cycv_rstmgr.c:1.1	Wed Sep 19 17:31:38 2018
+++ src/sys/arch/arm/altera/cycv_rstmgr.c	Sun Oct 14 18:53:01 2018
@@ -1,9 +1,9 @@
-/* $NetBSD: cycv_rstmgr.c,v 1.1 2018/09/19 17:31:38 aymeric Exp $ */
+/* $NetBSD: cycv_rstmgr.c,v 1.2 2018/10/14 18:53:01 aymeric Exp $ */
 
 /* This file is in the public domain. */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cycv_rstmgr.c,v 1.1 2018/09/19 17:31:38 aymeric Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cycv_rstmgr.c,v 1.2 2018/10/14 18:53:01 aymeric Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -98,11 +98,11 @@ cycv_rst_acquire(device_t dev, const voi
 
 	value = of_decode_int(data);
 	if (value < 0 || value >
-	    (CYCV_RSTMGR_MISCMODRST - CYCV_RSTMGR_PERMODRST + 4) / 4 * 32)
+	    (CYCV_RSTMGR_MISCMODRST - CYCV_RSTMGR_MPUMODRST + 4) / 4 * 32)
 		goto err_decode;
 
 	reset = kmem_alloc(sizeof *reset, KM_SLEEP);
-	reset->address = CYCV_RSTMGR_PERMODRST + value / 32 * 4;
+	reset->address = CYCV_RSTMGR_MPUMODRST + value / 32 * 4;
 	reset->mask = 1 << (value % 32);
 
 	if (0) {

Reply via email to