Module Name:    src
Committed By:   mrg
Date:           Mon Apr 12 09:23:33 UTC 2021

Modified Files:
        src/sys/dev/sbus: magma.c

Log Message:
handle cd1400_compute_baud() failure and avoid reading uninitialised
variables.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/sbus/magma.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/dev/sbus/magma.c
diff -u src/sys/dev/sbus/magma.c:1.61 src/sys/dev/sbus/magma.c:1.62
--- src/sys/dev/sbus/magma.c:1.61	Sun Nov 10 21:16:37 2019
+++ src/sys/dev/sbus/magma.c	Mon Apr 12 09:23:32 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: magma.c,v 1.61 2019/11/10 21:16:37 chs Exp $	*/
+/*	$NetBSD: magma.c,v 1.62 2021/04/12 09:23:32 mrg Exp $	*/
 
 /*-
  * Copyright (c) 1998 Iain Hibbert
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: magma.c,v 1.61 2019/11/10 21:16:37 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: magma.c,v 1.62 2021/04/12 09:23:32 mrg Exp $");
 
 #if 0
 #define MAGMA_DEBUG
@@ -1743,7 +1743,10 @@ mbpp_recv(struct mbpp_port *mp, void *pt
 		cd1400_write_reg(cd, CD1400_CAR, 0);
 
 		/* input strobe at 100kbaud (10microseconds) */
-		cd1400_compute_baud(100000, cd->cd_clock, &rcor, &rbpr);
+		if (cd1400_compute_baud(100000, cd->cd_clock, &rcor, &rbpr)) {
+			splx(s);
+			return 0;
+		}
 		cd1400_write_reg(cd, CD1400_RCOR, rcor);
 		cd1400_write_reg(cd, CD1400_RBPR, rbpr);
 

Reply via email to