Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/sbus handle cd1400_compute_baud() failure and avoid ...



details:   https://anonhg.NetBSD.org/src/rev/8abd48870748
branches:  trunk
changeset: 982405:8abd48870748
user:      mrg <mrg%NetBSD.org@localhost>
date:      Mon Apr 12 09:23:32 2021 +0000

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

diffstat:

 sys/dev/sbus/magma.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r 5bb1499feff9 -r 8abd48870748 sys/dev/sbus/magma.c
--- a/sys/dev/sbus/magma.c      Mon Apr 12 09:22:58 2021 +0000
+++ b/sys/dev/sbus/magma.c      Mon Apr 12 09:23:32 2021 +0000
@@ -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 @@
                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);
 



Home | Main Index | Thread Index | Old Index